SlideShare une entreprise Scribd logo
1  sur  17
Introducing the
Command Line
CMSC 121 Introduction to UNIX
Much of the material in these slides was taken from
Dan Hood’s CMSC 121 Lecture Notes.
Format of UNIX Commands
 UNIX commands can be very simple one word commands, or they can take a
number of additional arguments (parameters) as part of the command. In
general, a UNIX command has the following form:
command options(s) filename(s)
 The command is the name of the utility or program that we are going to
execute.
 The options modify the way the command works. It is typical for these options
to have be a hyphen followed by a single character, such as -a. It is also a
common convention under Linux to have options that are in the form of 2
hyphens followed by a word or hyphenated words, such as --color or --
pretty-print.
 The filename is the last argument for a lot of UNIX commands. It is simply
the file or files that you want the command to work on. Not all commands
work on files, such as ssh, which takes the name of a host as its argument.
Common UNIX Conventions
 In UNIX, the command is almost always
entered in all lowercase characters.
 Typically any options come before filenames.
 Many times, individual options may need a word
after them to designate some additional meaning
to the command.
Familiar Commands:
scp (Secure CoPy)
 The scp command is a way to copy files back
and forth between multiple computers.
 Formats for this command:
 scp path/local_name username@hostname:path/remote_name
 scp username@hostname:path/remote_name path/local_name
 Demo with renaming and copying files.
Familiar Commands:
ssh (Secure SHell)
 The ssh command is a way to securely connect to a remote computer.
 Formats for this command:
 ssh hostname
 ssh username@hostname
 ssh hostname -l username
 If you do not specify the username, it will assume that you want to connect
with the same username that you have on this local computer.
 Since you have a single username for all computers on the OIT network, you don’t
need to explicitly enter a username.
 But you can give a username, and will need to if your local username is different
that your GL username. This might be the case if you are logging on from home
and set up your username to be different from what it is on GL.
 Demo with connecting with different usernames.
Familiar Commands:
ssh (Secure SHell)
 You can save a couple of keystrokes if you are on one
of the Linux PCs in the labs:
 You really only need to specify enough of a hostname as you
may need.
 Linux will automatically attempt to fill out the hostname with
“umbc.edu” for you.
 So if you want to log onto the lightest loaded linux server on
gl, you only need to issue the following command...
ssh linux.gl
 Or, if you don't care the flavor of UNIX, you can simply
type...
ssh gl
Familiar Commands:
passwd (change PASSWorD)
 The passwd command changes your UNIX
password.
 This command is an example of a “no
argument” command. Thus, the format of this
command is just the command name itself.
passwd
 passwd is an interactive command, as once we
have typed it, we need to interact with it.
Familiar Commands:
quota (account QUOTA)
 The quota command shows you how much
storage space you have left in your account.
 When we use this command, we have to specify
the -v option to get the information for our
account.
 The format of this command is:
quota -v
Familiar Commands:
oitcleaner (account cleaning tool)
 The oitcleaner account cleaning tool was
developed by the UMBC OIT department.
 This command is specific to the UMBC GL systems.
 This command takes no options and no
filenames, so its format is:
oitcleaner
Man Pages
 The man command allows you to access the
MANual pages for a UNIX command.
 To get additional help on any of the commands
listed below, you can always type man
name_of_command at the command prompt.
 Examples:
 man ssh
 man passwd
Commands
 ls : lists the contents of a directory
 l : long directory listing
 a : lists all files, including files which are normally hidden
 F : distinguishes between directories and regular files
 h : ? Look it up using man
 pwd : prints the current working directory
 cd : changes directories
 The difference between relative and absolute paths.
 Special characters ., .., and ~.
 mkdir : creates a directory
 rmdir : removes a directory (assuming it is empty)
 If you get an error that the directory isn’t empty even though it looks
empty, check for hidden files.
Commands
 touch : creates an empty file with the specified name,
or if the file already exists it modifies the timestamp.
 rm : removes a file.
 f : force deletion
 r : recursive deletion
 mv - moves a file, or renames a file
 f : forces overwrite, if the destination file exists
 cp - copies a file, leaving the original intact
 f : forces overwrite, if the destination file exists
 r : recursive copying of directories
Commands
 cat : shows the contents of a file, all at once
 more : shows the contents of a file, screen by
screen
 less : also shows the contents of a file, screen by
screen
 head : used to show so many lines form the top
of a file
 tail : used to show so many lines form the
bottom of a file
Commands
 lpr : prints a file
 alias : creates an alias for a command.
 Aliases can be placed in your .cshrc login script.
 Example: alias rm ‘rm –i’.
 date : shows the date and time on the current system
 who : used to print out a list of users on the current
system
 hostname : prints the hostname of the current
computer
 whoami : prints your current username
The UNIX Pipe (|)
 The pipe (|) creates a channel from one command to another.
Think of the pipe as a way of connecting the output from one
command to the input of another command.
 The pipe can be used to link commands together to perform
more complex tasks that would otherwise take multiple steps
(and possibly writing information to disk).
 Examples:
 Count the number of users logged onto the current system.
 The who command will give us line by line output of all the current users.
 We could then use the wc -l to count the number of lines...
 who | wc –l
 Display long listings in a scrollable page.
 The lpq command will give us a list of the waiting print jobs.
 lpq | less
Commands
 ps : lists the processes running on the machine.
 ps -u username lists only your processes.
 ps -a : lists all processes running on the machine.
 The PID column of the listing, provides the information
required by the kill command.
 kill : terminates a process
 kill process_id : sends a terminate signal to the process
specified by the process_id (PID).
 In cases where the terminate signal does not work, the
command "kill -9 process_id" sends a kill signal to the process.
 nice : runs a process with a lower priority.

Contenu connexe

Similaire à Intro to Command Line CMSC 121

Similaire à Intro to Command Line CMSC 121 (20)

Nithi
NithiNithi
Nithi
 
60761 linux
60761 linux60761 linux
60761 linux
 
Using Unix
Using UnixUsing Unix
Using Unix
 
50 Most Frequently Used UNIX Linux Commands -hmftj
50 Most Frequently Used UNIX  Linux Commands -hmftj50 Most Frequently Used UNIX  Linux Commands -hmftj
50 Most Frequently Used UNIX Linux Commands -hmftj
 
Group13
Group13Group13
Group13
 
3. intro
3. intro3. intro
3. intro
 
cisco
ciscocisco
cisco
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 
Linuxs1
Linuxs1Linuxs1
Linuxs1
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
Chapter 3 Using Unix Commands
Chapter 3 Using Unix CommandsChapter 3 Using Unix Commands
Chapter 3 Using Unix Commands
 
Linux
LinuxLinux
Linux
 
50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
50 most frequently used unix linux commands (with examples)
50 most frequently used unix   linux commands (with examples)50 most frequently used unix   linux commands (with examples)
50 most frequently used unix linux commands (with examples)
 
intro unix/linux 02
intro unix/linux 02intro unix/linux 02
intro unix/linux 02
 
58518522 study-aix
58518522 study-aix58518522 study-aix
58518522 study-aix
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Unit 1-a-brief-history-of-unix-ppt
Unit 1-a-brief-history-of-unix-pptUnit 1-a-brief-history-of-unix-ppt
Unit 1-a-brief-history-of-unix-ppt
 
Red hat linux essentials
Red hat linux essentialsRed hat linux essentials
Red hat linux essentials
 

Dernier

(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样
(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样
(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样whjjkkk
 
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一fhhkjh
 
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607dollysharma2066
 
call girls in G.T.B. Nagar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in  G.T.B. Nagar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in  G.T.B. Nagar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in G.T.B. Nagar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样gfghbihg
 
What Could Cause A VW Tiguan's Radiator Fan To Stop Working
What Could Cause A VW Tiguan's Radiator Fan To Stop WorkingWhat Could Cause A VW Tiguan's Radiator Fan To Stop Working
What Could Cause A VW Tiguan's Radiator Fan To Stop WorkingEscondido German Auto
 
Call Girls in Karachi | +923081633338 | Karachi Call Girls
Call Girls in Karachi  | +923081633338 | Karachi Call GirlsCall Girls in Karachi  | +923081633338 | Karachi Call Girls
Call Girls in Karachi | +923081633338 | Karachi Call GirlsAyesha Khan
 
2.2 CLSS hydraulic Pumps on komatsu pc200 series
2.2 CLSS hydraulic Pumps on komatsu pc200 series2.2 CLSS hydraulic Pumps on komatsu pc200 series
2.2 CLSS hydraulic Pumps on komatsu pc200 seriesdatazaky
 
suspensionretardersystem-220726153321-060937ae.pptx
suspensionretardersystem-220726153321-060937ae.pptxsuspensionretardersystem-220726153321-060937ae.pptx
suspensionretardersystem-220726153321-060937ae.pptxbasant11731
 
UNIT-V-ELECTRIC AND HYBRID VEHICLES.pptx
UNIT-V-ELECTRIC AND HYBRID VEHICLES.pptxUNIT-V-ELECTRIC AND HYBRID VEHICLES.pptx
UNIT-V-ELECTRIC AND HYBRID VEHICLES.pptxDineshKumar4165
 
UNOSAFE ELEVATOR PRIVATE LTD BANGALORE BROUCHER
UNOSAFE ELEVATOR PRIVATE LTD BANGALORE BROUCHERUNOSAFE ELEVATOR PRIVATE LTD BANGALORE BROUCHER
UNOSAFE ELEVATOR PRIVATE LTD BANGALORE BROUCHERunosafeads
 
办理萨省大学毕业证成绩单|购买加拿大USASK文凭证书
办理萨省大学毕业证成绩单|购买加拿大USASK文凭证书办理萨省大学毕业证成绩单|购买加拿大USASK文凭证书
办理萨省大学毕业证成绩单|购买加拿大USASK文凭证书zdzoqco
 
Equity & Freight Electrification by Jose Miguel Acosta Cordova
Equity & Freight Electrification by Jose Miguel Acosta CordovaEquity & Freight Electrification by Jose Miguel Acosta Cordova
Equity & Freight Electrification by Jose Miguel Acosta CordovaForth
 
Not Sure About VW EGR Valve Health Look For These Symptoms
Not Sure About VW EGR Valve Health Look For These SymptomsNot Sure About VW EGR Valve Health Look For These Symptoms
Not Sure About VW EGR Valve Health Look For These SymptomsFifth Gear Automotive
 
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一F La
 
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证jjrehjwj11gg
 
Digamma - CertiCon Team Skills and Qualifications
Digamma - CertiCon Team Skills and QualificationsDigamma - CertiCon Team Skills and Qualifications
Digamma - CertiCon Team Skills and QualificationsMihajloManjak
 
Dubai Call Girls Services Call 09900000000
Dubai Call Girls Services Call 09900000000Dubai Call Girls Services Call 09900000000
Dubai Call Girls Services Call 09900000000Komal Khan
 
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptx
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptxUNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptx
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptxDineshKumar4165
 
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一hnfusn
 

Dernier (20)

(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样
(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样
(办理学位证)墨尔本大学毕业证(Unimelb毕业证书)成绩单留信学历认证原版一模一样
 
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一
定制(Plymouth文凭证书)普利茅斯大学毕业证毕业证成绩单学历认证原版一比一
 
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
( Best ) Genuine Call Girls In Mandi House =DELHI-| 8377087607
 
call girls in G.T.B. Nagar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in  G.T.B. Nagar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in  G.T.B. Nagar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in G.T.B. Nagar (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样
(办理学位证)(Toledo毕业证)托莱多大学毕业证成绩单修改留信学历认证原版一模一样
 
What Could Cause A VW Tiguan's Radiator Fan To Stop Working
What Could Cause A VW Tiguan's Radiator Fan To Stop WorkingWhat Could Cause A VW Tiguan's Radiator Fan To Stop Working
What Could Cause A VW Tiguan's Radiator Fan To Stop Working
 
Call Girls in Karachi | +923081633338 | Karachi Call Girls
Call Girls in Karachi  | +923081633338 | Karachi Call GirlsCall Girls in Karachi  | +923081633338 | Karachi Call Girls
Call Girls in Karachi | +923081633338 | Karachi Call Girls
 
2.2 CLSS hydraulic Pumps on komatsu pc200 series
2.2 CLSS hydraulic Pumps on komatsu pc200 series2.2 CLSS hydraulic Pumps on komatsu pc200 series
2.2 CLSS hydraulic Pumps on komatsu pc200 series
 
suspensionretardersystem-220726153321-060937ae.pptx
suspensionretardersystem-220726153321-060937ae.pptxsuspensionretardersystem-220726153321-060937ae.pptx
suspensionretardersystem-220726153321-060937ae.pptx
 
UNIT-V-ELECTRIC AND HYBRID VEHICLES.pptx
UNIT-V-ELECTRIC AND HYBRID VEHICLES.pptxUNIT-V-ELECTRIC AND HYBRID VEHICLES.pptx
UNIT-V-ELECTRIC AND HYBRID VEHICLES.pptx
 
UNOSAFE ELEVATOR PRIVATE LTD BANGALORE BROUCHER
UNOSAFE ELEVATOR PRIVATE LTD BANGALORE BROUCHERUNOSAFE ELEVATOR PRIVATE LTD BANGALORE BROUCHER
UNOSAFE ELEVATOR PRIVATE LTD BANGALORE BROUCHER
 
办理萨省大学毕业证成绩单|购买加拿大USASK文凭证书
办理萨省大学毕业证成绩单|购买加拿大USASK文凭证书办理萨省大学毕业证成绩单|购买加拿大USASK文凭证书
办理萨省大学毕业证成绩单|购买加拿大USASK文凭证书
 
Equity & Freight Electrification by Jose Miguel Acosta Cordova
Equity & Freight Electrification by Jose Miguel Acosta CordovaEquity & Freight Electrification by Jose Miguel Acosta Cordova
Equity & Freight Electrification by Jose Miguel Acosta Cordova
 
Not Sure About VW EGR Valve Health Look For These Symptoms
Not Sure About VW EGR Valve Health Look For These SymptomsNot Sure About VW EGR Valve Health Look For These Symptoms
Not Sure About VW EGR Valve Health Look For These Symptoms
 
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一
办理(PITT毕业证书)美国匹兹堡大学毕业证成绩单原版一比一
 
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
原版工艺美国普林斯顿大学毕业证Princeton毕业证成绩单修改留信学历认证
 
Digamma - CertiCon Team Skills and Qualifications
Digamma - CertiCon Team Skills and QualificationsDigamma - CertiCon Team Skills and Qualifications
Digamma - CertiCon Team Skills and Qualifications
 
Dubai Call Girls Services Call 09900000000
Dubai Call Girls Services Call 09900000000Dubai Call Girls Services Call 09900000000
Dubai Call Girls Services Call 09900000000
 
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptx
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptxUNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptx
UNIT-IV-STEERING, BRAKES AND SUSPENSION SYSTEMS.pptx
 
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一
如何办理(UQ毕业证书)昆士兰大学毕业证毕业证成绩单原版一比一
 

Intro to Command Line CMSC 121

  • 1. Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
  • 2. Format of UNIX Commands  UNIX commands can be very simple one word commands, or they can take a number of additional arguments (parameters) as part of the command. In general, a UNIX command has the following form: command options(s) filename(s)  The command is the name of the utility or program that we are going to execute.  The options modify the way the command works. It is typical for these options to have be a hyphen followed by a single character, such as -a. It is also a common convention under Linux to have options that are in the form of 2 hyphens followed by a word or hyphenated words, such as --color or -- pretty-print.  The filename is the last argument for a lot of UNIX commands. It is simply the file or files that you want the command to work on. Not all commands work on files, such as ssh, which takes the name of a host as its argument.
  • 3. Common UNIX Conventions  In UNIX, the command is almost always entered in all lowercase characters.  Typically any options come before filenames.  Many times, individual options may need a word after them to designate some additional meaning to the command.
  • 4. Familiar Commands: scp (Secure CoPy)  The scp command is a way to copy files back and forth between multiple computers.  Formats for this command:  scp path/local_name username@hostname:path/remote_name  scp username@hostname:path/remote_name path/local_name  Demo with renaming and copying files.
  • 5. Familiar Commands: ssh (Secure SHell)  The ssh command is a way to securely connect to a remote computer.  Formats for this command:  ssh hostname  ssh username@hostname  ssh hostname -l username  If you do not specify the username, it will assume that you want to connect with the same username that you have on this local computer.  Since you have a single username for all computers on the OIT network, you don’t need to explicitly enter a username.  But you can give a username, and will need to if your local username is different that your GL username. This might be the case if you are logging on from home and set up your username to be different from what it is on GL.  Demo with connecting with different usernames.
  • 6. Familiar Commands: ssh (Secure SHell)  You can save a couple of keystrokes if you are on one of the Linux PCs in the labs:  You really only need to specify enough of a hostname as you may need.  Linux will automatically attempt to fill out the hostname with “umbc.edu” for you.  So if you want to log onto the lightest loaded linux server on gl, you only need to issue the following command... ssh linux.gl  Or, if you don't care the flavor of UNIX, you can simply type... ssh gl
  • 7. Familiar Commands: passwd (change PASSWorD)  The passwd command changes your UNIX password.  This command is an example of a “no argument” command. Thus, the format of this command is just the command name itself. passwd  passwd is an interactive command, as once we have typed it, we need to interact with it.
  • 8. Familiar Commands: quota (account QUOTA)  The quota command shows you how much storage space you have left in your account.  When we use this command, we have to specify the -v option to get the information for our account.  The format of this command is: quota -v
  • 9. Familiar Commands: oitcleaner (account cleaning tool)  The oitcleaner account cleaning tool was developed by the UMBC OIT department.  This command is specific to the UMBC GL systems.  This command takes no options and no filenames, so its format is: oitcleaner
  • 10. Man Pages  The man command allows you to access the MANual pages for a UNIX command.  To get additional help on any of the commands listed below, you can always type man name_of_command at the command prompt.  Examples:  man ssh  man passwd
  • 11. Commands  ls : lists the contents of a directory  l : long directory listing  a : lists all files, including files which are normally hidden  F : distinguishes between directories and regular files  h : ? Look it up using man  pwd : prints the current working directory  cd : changes directories  The difference between relative and absolute paths.  Special characters ., .., and ~.  mkdir : creates a directory  rmdir : removes a directory (assuming it is empty)  If you get an error that the directory isn’t empty even though it looks empty, check for hidden files.
  • 12. Commands  touch : creates an empty file with the specified name, or if the file already exists it modifies the timestamp.  rm : removes a file.  f : force deletion  r : recursive deletion  mv - moves a file, or renames a file  f : forces overwrite, if the destination file exists  cp - copies a file, leaving the original intact  f : forces overwrite, if the destination file exists  r : recursive copying of directories
  • 13. Commands  cat : shows the contents of a file, all at once  more : shows the contents of a file, screen by screen  less : also shows the contents of a file, screen by screen  head : used to show so many lines form the top of a file  tail : used to show so many lines form the bottom of a file
  • 14. Commands  lpr : prints a file  alias : creates an alias for a command.  Aliases can be placed in your .cshrc login script.  Example: alias rm ‘rm –i’.  date : shows the date and time on the current system  who : used to print out a list of users on the current system  hostname : prints the hostname of the current computer  whoami : prints your current username
  • 15. The UNIX Pipe (|)  The pipe (|) creates a channel from one command to another. Think of the pipe as a way of connecting the output from one command to the input of another command.  The pipe can be used to link commands together to perform more complex tasks that would otherwise take multiple steps (and possibly writing information to disk).  Examples:  Count the number of users logged onto the current system.  The who command will give us line by line output of all the current users.  We could then use the wc -l to count the number of lines...  who | wc –l  Display long listings in a scrollable page.  The lpq command will give us a list of the waiting print jobs.  lpq | less
  • 16.
  • 17. Commands  ps : lists the processes running on the machine.  ps -u username lists only your processes.  ps -a : lists all processes running on the machine.  The PID column of the listing, provides the information required by the kill command.  kill : terminates a process  kill process_id : sends a terminate signal to the process specified by the process_id (PID).  In cases where the terminate signal does not work, the command "kill -9 process_id" sends a kill signal to the process.  nice : runs a process with a lower priority.