Command Line.pptx

Full Transcript

Faculty of Computing and Informatics System Administration(SAD622S) Faculty of Computing and Informatics Contents 1. Command Line 2. Apply Redirection 3. Practising commonly used commands Command Line Faculty of Computing and Informatics Command Line Why would w...

Faculty of Computing and Informatics System Administration(SAD622S) Faculty of Computing and Informatics Contents 1. Command Line 2. Apply Redirection 3. Practising commonly used commands Command Line Faculty of Computing and Informatics Command Line Why would we want to go back to the command line, we have a graphical interface after all? Graphical interface is nice, but does not give you access to all of your operating system. Well established administrators would have a folder of scripts used within their environment. Command Line Faculty of Computing and Informatics Command Line The command line gives you more control and you can achieve your goals quickly and securely. Don’t be afraid You don’t have to remember exact syntax. Command line gives access to more information on your PC. Usually in Windows you would view processes through the task managers processes tab. There are many other processes that you might not know. Processes Faculty of Computing and Informatics Processes A process is a program in execution. Processes are created by the shell in response to commands. Processes are identified by a unique process identifier or PID. The INIT process: This is the first process to be created when a UNIX system starts up Has a PID of 1. All other processes are said to be "descendants" of INIT. It is always present in the system Windows Command Line Faculty of Computing and Informatics Windows Command Line A reminder for windows command line tool, remember /?. The /? with any command should give you information on how to use the command. Windows command line can be utilized for scheduling and scripting tasks. Net user, dsmod, dsadd, dsmove etc Linux Command Line Faculty of Computing and Informatics Linux Command Line Remember manual pages to get information on commands. The syntax for man is: man command Linux preferred within System Administration because of command/shell usage and the control it provides. Redirecting in Command Line Faculty of Computing and Informatics Redirecting in Command Line Command line support three forms of Re- direction: Output, Input, and Piping. Specialized character are used for each. Pipe (|), it acts as a pipe between applications, transferring data from one application to another. e.g. TaskList /? | more The Pipe Operator (|) Faculty of Computing and Informatics The Pipe Operator (|) Used to create concurrently executing processes that pass data directly to one another. It is useful for combining system utilities to perform more complex functions. Example $ cat hello.txt | grep "dog" | grep -v "cat" finds all lines in hello.txt that contain the string "dog" but do not contain the string "cat". Redirecting Output Faculty of Computing and Informatics Redirecting output (>, >>) and input ( operator: If we want to append the output of a command to the end of a file we use the >> operator: Redirecting Output Faculty of Computing and Informatics Redirecting output (>, >>) and input ( operator with a 2 (in LINUX the file numbers 0, 1 and 2 are assigned to standard input, standard output and standard error respectively)  Standard input can also be redirected using the < operator, so that input is read from a file instead of the keyboard.  You can combine input redirection with output redirection.  You can pass standard output to system utilities that require filenames as "-". Example:  $ cat package.tar.gz | gzip -d | tar tvf -  Here the output of the gzip -d command is used as the Foreground and Background Faculty of Computing and Informatics Foreground and Background Execution ◦ The foreground job has control of the shell with which you interact - it receives input from the keyboard and sends output to the screen. There can be only one job in the foreground at any time.  The foreground job may be suspended, (Ctrl- Z).  fg or bg commands to resume execution. ◦ Jobs in the background run without the need for interaction.  Use of & and bg ◦ Both foreground and background jobs can be interrupted (Ctrl-C) or killed off permanently by  kill command (SIGTERM signal)  kill -9 command (SIGKILL signal) Windows Commands Faculty of Computing and Informatics Windows Commonly used Commands dir – Listing the directory findstr – finding files and string patterns copy – copying files and directories del/deltree/erase – removing files and directories mkdir/md – Making directories move – moving or renaming files Ren – renaming a file Linux Commands Faculty of Computing and Informatics Linux Commonly used Commands ls – listing directory contents mkdir – creating directories rm- removing files and directories mv – moving or renaming files find/locate – find files and directories which – shows if commands are installed on the system Cp, vi, cat, touch, less, more, date, cal, scp, etc …. Points to Ponder Faculty of Computing and Informatics Points to Ponder What are some third party command line tools available? How is the path variable set in Windows command line; What makes the Windows Vista PowerShell better than previous command line tools? 13 Storch Street T: +264 61 207 2258 Private Bag 13388 F: +264 61 207 9258 Windhoek E: [email protected] NAMIBIA W: www.nust.na Faculty of Computing and Informatics Thank You.

Use Quizgecko on...
Browser
Browser