Download presentation
Presentation is loading. Please wait.
Published byΖεφύρα Παπαδάκης Modified over 6 years ago
1
(Chapter 2) John Carelli, Instructor Kutztown University
2
Unix Commands A command is an instruction issued by a user that tells the computer to perform a specific task. Commands are generally issued by typing them in at the command line (via a text-based interface, or terminal) and pressing the ENTER key. The command then gets passed to a shell for interpretation. The shell/command-line interface is interactive, but the commands themselves are generally non-interactive. User input is provided via command line arguments Allows a command to take input from the output of another command Allows commands to be run on scheduled times Allows for design of applications that adjust their behavior via configuration files
3
example: ls -l -u -t chap01
Structure of a Command example: ls -l -u -t chap01 Command filenames need no specific extensions. A command’s behavior is determined by its arguments and options. Command and arguments must be separated by whitespace. Generally possible to combine multiple options into a single one (ls -l -u -t == ls -lut) Order of combining is generally not important (ls -lut == ls -utl)
4
Types of Commands External program on disk which could be
a binary executable (written in C, C++). a script file (like a shell or perl script). Internal command of the shell which could be a builtin (like cd, pwd, etc.) an alias defined by the user that invokes the disk or internal version in a specific manner.
5
How the Shell Determines the Command to Run
If command is invoked with a pathname (like /bin/echo), the shell runs program at the specified location. If command is invoked without a pathname, the shell first checks whether it is an alias or builtin: If alias or builtin, the shell runs it without looking in disk. If not, the shell looks at the PATH variable for directories where the command may reside. more on this later….
6
clear echo date script (save terminal output) who (who is logged in) w (who is logged in and what they are doing) finger (disabled)
7
man apropos (man –k) info (gui-like, tree based) help (for built-in commands) which (path to named command) whereis (paths to commands and command information) locate (depends on a database)
8
Control-c (interrupt)
Control-s (stop output to terminal) Control-q (restart output to terminal) Control-d (eof)
9
USERS & GROUPS User Accounts System accounts (more info here)
id (user name/group id number info) groups (user’s group memberships) newgrp (see current group with id –ng) System accounts (more info here) root (superuser) daemon (system server processes/files) bin (owns system executables and files) sys (for Distributed File Services, DFS) lp (printers) adm (basic system functions) nobody (default for unprivileged operations) whoami (id –un)
10
Session Environment variable Metacharacters stty stty -a
stty <metacharacter string> <value>
11
time hostname nslookup uname (-a)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.