SlideShare a Scribd company logo
Introducing theIntroducing the
Command LineCommand Line
CMSC 121 Introduction to UNIXCMSC 121 Introduction to UNIX
Much of the material in these slides was taken fromMuch of the material in these slides was taken from
Dan Hood’s CMSC 121 Lecture Notes.Dan Hood’s CMSC 121 Lecture Notes.
Format of UNIX CommandsFormat of UNIX Commands
 UNIX commands can be very simple one word commands, or they can take aUNIX commands can be very simple one word commands, or they can take a
number of additional arguments (parameters) as part of the command. Innumber of additional arguments (parameters) as part of the command. In
general, a UNIX command has the following form:general, a UNIX command has the following form:
command options(s) filename(s)command options(s) filename(s)
 TheThe commandcommand is the name of the utility or program that we are going tois the name of the utility or program that we are going to
execute.execute.
 TheThe optionsoptions modify the way the command works. It is typical for these optionsmodify the way the command works. It is typical for these options
to have be a hyphen followed by a single character, such asto have be a hyphen followed by a single character, such as -a-a. It is also a. It is also a
common convention under Linux to have options that are in the form of 2common convention under Linux to have options that are in the form of 2
hyphens followed by a word or hyphenated words, such ashyphens followed by a word or hyphenated words, such as --color--color oror
--pretty-print--pretty-print..
 TheThe filenamefilename is the last argument for a lot of UNIX commands. It is simply theis 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 workfile or files that you want the command to work on. Not all commands work
on files, such ason files, such as sshssh, which takes the name of a host as its argument., which takes the name of a host as its argument.
Common UNIX ConventionsCommon UNIX Conventions
 In UNIX, the command is almost alwaysIn UNIX, the command is almost always
entered in allentered in all lowercaselowercase characters.characters.
 Typically any options come before filenames.Typically any options come before filenames.
 Many times, individual options may need a wordMany times, individual options may need a word
after them to designate some additional meaningafter them to designate some additional meaning
to the command.to the command.
Familiar Commands:Familiar Commands:
scp (Secure CoPy)scp (Secure CoPy)
 TheThe scpscp command is a way to copy files backcommand is a way to copy files back
and forth between multiple computers.and forth between multiple computers.
 Formats for this command:Formats for this command:
 scp path/local_name username@hostname:path/remote_namescp path/local_name username@hostname:path/remote_name
 scp username@hostname:path/remote_name path/local_namescp username@hostname:path/remote_name path/local_name
 Demo with renaming and copying files.Demo with renaming and copying files.
Familiar Commands:Familiar Commands:
ssh (Secure SHell)ssh (Secure SHell)
 TheThe sshssh command is a way to securely connect to a remote computer.command is a way to securely connect to a remote computer.
 Formats for this command:Formats for this command:
 ssh hostnamessh hostname
 ssh username@hostnamessh username@hostname
 ssh hostname -l usernamessh hostname -l username
 If you do not specify the username, it will assume that you want to connectIf 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.with the same username that you have on this local computer.
 Since you have a single username for all computers on the OIT network, youSince you have a single username for all computers on the OIT network, you
don’t need to explicitly enter a username.don’t need to explicitly enter a username.
 But you can give a username, and will need to if your local username is differentBut 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 homethat 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.and set up your username to be different from what it is on GL.
 Demo with connecting with different usernames.Demo with connecting with different usernames.
Familiar Commands:Familiar Commands:
ssh (Secure SHell)ssh (Secure SHell)
 You can save a couple of keystrokes if you are on oneYou can save a couple of keystrokes if you are on one
of the Linux PCs in the labs:of the Linux PCs in the labs:
 You really only need to specify enough of a hostname as youYou really only need to specify enough of a hostname as you
may need.may need.
 Linux will automatically attempt to fill out the hostname withLinux will automatically attempt to fill out the hostname with
“umbc.edu” for you.“umbc.edu” for you.
 So if you want to log onto the lightest loaded linux server onSo if you want to log onto the lightest loaded linux server on
gl, you only need to issue the following command...gl, you only need to issue the following command...
ssh linux.glssh linux.gl
 Or, if you don't care the flavor of UNIX, you can simplyOr, if you don't care the flavor of UNIX, you can simply
type...type...
ssh glssh gl
Familiar Commands:Familiar Commands:
passwd (change PASSWorD)passwd (change PASSWorD)
 TheThe passwdpasswd command changes your UNIXcommand changes your UNIX
password.password.
 This command is an example of a “noThis command is an example of a “no
argument” command. Thus, the format of thisargument” command. Thus, the format of this
command is just the command name itself.command is just the command name itself.
passwdpasswd
 passwd is an interactive command, as once wepasswd is an interactive command, as once we
have typed it, we need to interact with it.have typed it, we need to interact with it.
Familiar Commands:Familiar Commands:
quota (account QUOTA)quota (account QUOTA)
 TheThe quotaquota command shows you how muchcommand shows you how much
storage space you have left in your account.storage space you have left in your account.
 When we use this command, we have to specifyWhen we use this command, we have to specify
the -v option to get the information forthe -v option to get the information for ourour
account.account.
 The format of this command is:The format of this command is:
quota -vquota -v
Familiar Commands:Familiar Commands:
oitcleaner (account cleaning tool)oitcleaner (account cleaning tool)
 TheThe oitcleaneroitcleaner account cleaning tool wasaccount cleaning tool was
developed by the UMBC OIT department.developed by the UMBC OIT department.
 This command is specific to the UMBC GL systems.This command is specific to the UMBC GL systems.
 This command takes no options and noThis command takes no options and no
filenames, so its format is:filenames, so its format is:
oitcleaneroitcleaner
Man PagesMan Pages
 TheThe manman command allows you to access thecommand allows you to access the
MANual pages for a UNIX command.MANual pages for a UNIX command.
 To get additional help on any of the commandsTo get additional help on any of the commands
listed below, you can always typelisted below, you can always type manman
name_of_commandname_of_command at the command prompt.at the command prompt.
 Examples:Examples:
 man sshman ssh
 man passwdman passwd
CommandsCommands
 ls :ls : lists the contents of a directorylists the contents of a directory
 l : long directory listingl : long directory listing
 a : lists all files, including files which are normally hiddena : lists all files, including files which are normally hidden
 F : distinguishes between directories and regular filesF : distinguishes between directories and regular files
 h : ? Look it up usingh : ? Look it up using manman
 pwdpwd : prints the current working directory: prints the current working directory
 cdcd : changes directories: changes directories
 The difference between relative and absolute paths.The difference between relative and absolute paths.
 Special charactersSpecial characters ..,, ...., and, and ~~..
 mkdirmkdir : creates a directory: creates a directory
 rmdirrmdir : removes a directory (assuming it is empty): removes a directory (assuming it is empty)
 If you get an error that the directory isn’t empty even though it looksIf you get an error that the directory isn’t empty even though it looks
empty, check for hidden files.empty, check for hidden files.
CommandsCommands
 touchtouch : creates an empty file with the specified name,: creates an empty file with the specified name,
or if the file already exists it modifies the timestamp.or if the file already exists it modifies the timestamp.
 rmrm : removes a file.: removes a file.
 f : force deletionf : force deletion
 r : recursive deletionr : recursive deletion
 mvmv - moves a file, or renames a file- moves a file, or renames a file
 f : forces overwrite, if the destination file existsf : forces overwrite, if the destination file exists
 cpcp - copies a file, leaving the original intact- copies a file, leaving the original intact
 f : forces overwrite, if the destination file existsf : forces overwrite, if the destination file exists
 r : recursive copying of directoriesr : recursive copying of directories
CommandsCommands
 catcat : shows the contents of a file, all at once: shows the contents of a file, all at once
 moremore : shows the contents of a file, screen by: shows the contents of a file, screen by
screenscreen
 lessless : also shows the contents of a file, screen by: also shows the contents of a file, screen by
screenscreen
 headhead : used to show so many lines form the top: used to show so many lines form the top
of a fileof a file
 tailtail : used to show so many lines form the: used to show so many lines form the
bottom of a filebottom of a file
CommandsCommands
 lprlpr : prints a file: prints a file
 aliasalias :: creates an alias for a command.creates an alias for a command.
 Aliases can be placed in yourAliases can be placed in your .cshrc.cshrc login script.login script.
 Example: alias rm ‘rm –i’.Example: alias rm ‘rm –i’.
 datedate : shows the date and time on the current system: shows the date and time on the current system
 whowho : used to print out a list of users on the current: used to print out a list of users on the current
systemsystem
 hostnamehostname : prints the hostname of the current: prints the hostname of the current
computercomputer
 whoamiwhoami : prints your current username: prints your current username
The UNIX Pipe (|)The UNIX Pipe (|)
 The pipe (|) creates a channel from one command to another.The pipe (|) creates a channel from one command to another.
Think of the pipe as a way of connecting the output from oneThink of the pipe as a way of connecting the output from one
command to the input of another command.command to the input of another command.
 The pipe can be used to link commands together to performThe pipe can be used to link commands together to perform
more complex tasks that would otherwise take multiple stepsmore complex tasks that would otherwise take multiple steps
(and possibly writing information to disk).(and possibly writing information to disk).
 Examples:Examples:
 Count the number of users logged onto the current system.Count the number of users logged onto the current system.
 TheThe whowho command will give us line by line output of all the current users.command will give us line by line output of all the current users.
 We could then use theWe could then use the wc -lwc -l to count the number of lines...to count the number of lines...
 who | wc –lwho | wc –l
 Display long listings in a scrollable page.Display long listings in a scrollable page.
 TheThe lpqlpq command will give us a list of the waiting print jobs.command will give us a list of the waiting print jobs.
 lpq | lesslpq | less
CommandsCommands
 psps : lists the processes running on the machine.: lists the processes running on the machine.
 ps -ups -u usernameusername lists only your processes.lists only your processes.
 ps -aps -a : lists all processes running on the machine.: lists all processes running on the machine.
 The PID column of the listing, provides the informationThe PID column of the listing, provides the information
required by the kill command.required by the kill command.
 killkill : terminates a process: terminates a process
 killkill process_idprocess_id : sends a terminate signal to the process: sends a terminate signal to the process
specified by thespecified by the process_idprocess_id (PID).(PID).
 In cases where the terminate signal does not work, theIn cases where the terminate signal does not work, the
command "command "killkill -9-9 process_idprocess_id" sends a kill signal to the process." sends a kill signal to the process.
 nicenice : runs a process with a lower priority.: runs a process with a lower priority.

More Related Content

What's hot

Linux Shortcuts and Commands:
Linux Shortcuts and Commands:Linux Shortcuts and Commands:
Linux Shortcuts and Commands:wensheng wei
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
lucita cabral
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command Shell
Tushar B Kute
 
Os lab manual
Os lab manualOs lab manual
Os lab manual
Neelamani Samal
 
Linux Basic commands and VI Editor
Linux Basic commands and VI EditorLinux Basic commands and VI Editor
Linux Basic commands and VI Editor
shanmuga rajan
 
Command-Line 101
Command-Line 101Command-Line 101
Command-Line 101
Artefactual Systems - AtoM
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinuxtutorialsruby
 
One Page Linux Manual
One Page Linux ManualOne Page Linux Manual
One Page Linux Manualdummy
 
Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
VIKAS TIWARI
 
UNIX Command Cheat Sheets
UNIX Command Cheat SheetsUNIX Command Cheat Sheets
UNIX Command Cheat Sheets
Prashanth Kumar
 
Linux system admin useful commands
Linux system admin useful commandsLinux system admin useful commands
Linux system admin useful commandsali98091
 
Exploring Code with Pry!
Exploring Code with Pry!Exploring Code with Pry!
Exploring Code with Pry!
Clayton Parker
 
Clase10 (consola linux)
Clase10 (consola linux)Clase10 (consola linux)
Clase10 (consola linux)
Miguel Eduardo Luces
 
11 unix osx_commands
11 unix osx_commands11 unix osx_commands
11 unix osx_commands
Macinfosoft
 
Unix environment [autosaved]
Unix environment [autosaved]Unix environment [autosaved]
Unix environment [autosaved]
Er Mittinpreet Singh
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
Shakeel Shafiq
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell script
Bhavesh Padharia
 

What's hot (20)

Linux Shortcuts and Commands:
Linux Shortcuts and Commands:Linux Shortcuts and Commands:
Linux Shortcuts and Commands:
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
Unix - Filters/Editors
Unix - Filters/EditorsUnix - Filters/Editors
Unix - Filters/Editors
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command Shell
 
Os lab manual
Os lab manualOs lab manual
Os lab manual
 
Linux Basic commands and VI Editor
Linux Basic commands and VI EditorLinux Basic commands and VI Editor
Linux Basic commands and VI Editor
 
Command-Line 101
Command-Line 101Command-Line 101
Command-Line 101
 
InstallingRoRinLinux
InstallingRoRinLinuxInstallingRoRinLinux
InstallingRoRinLinux
 
One Page Linux Manual
One Page Linux ManualOne Page Linux Manual
One Page Linux Manual
 
Sahul
SahulSahul
Sahul
 
Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
 
UNIX Command Cheat Sheets
UNIX Command Cheat SheetsUNIX Command Cheat Sheets
UNIX Command Cheat Sheets
 
Linux system admin useful commands
Linux system admin useful commandsLinux system admin useful commands
Linux system admin useful commands
 
lec4.docx
lec4.docxlec4.docx
lec4.docx
 
Exploring Code with Pry!
Exploring Code with Pry!Exploring Code with Pry!
Exploring Code with Pry!
 
Clase10 (consola linux)
Clase10 (consola linux)Clase10 (consola linux)
Clase10 (consola linux)
 
11 unix osx_commands
11 unix osx_commands11 unix osx_commands
11 unix osx_commands
 
Unix environment [autosaved]
Unix environment [autosaved]Unix environment [autosaved]
Unix environment [autosaved]
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell script
 

Similar to Intro commandline

IntroCommandLine.ppt
IntroCommandLine.pptIntroCommandLine.ppt
IntroCommandLine.ppt
GowthamRaju15
 
IntroCommandLine.ppt
IntroCommandLine.pptIntroCommandLine.ppt
IntroCommandLine.ppt
TECHWORLDwithphotoed
 
Using Unix
Using UnixUsing Unix
Using UnixDr.Ravi
 
Linux Command.pptx
Linux Command.pptxLinux Command.pptx
Linux Command.pptx
SaileshB5
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.ppt
LuigysToro
 
Linux commands
Linux commandsLinux commands
Linux commands
Meenu Chopra
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
Tushar Jain
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structure
Sreenatha Reddy K R
 
Linux week 2
Linux week 2Linux week 2
Linux week 2
Vinoth Sn
 
60761 linux
60761 linux60761 linux
60761 linux
Ritika Ahlawat
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to UnixSudharsan S
 
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
Rahul Mashal
 
Linux
LinuxLinux
Linux presentation
Linux presentationLinux presentation
Linux presentationNikhil Jain
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
kavitha_tala
 

Similar to Intro commandline (20)

IntroCommandLine.ppt
IntroCommandLine.pptIntroCommandLine.ppt
IntroCommandLine.ppt
 
IntroCommandLine.ppt
IntroCommandLine.pptIntroCommandLine.ppt
IntroCommandLine.ppt
 
Using Unix
Using UnixUsing Unix
Using Unix
 
cisco
ciscocisco
cisco
 
3. intro
3. intro3. intro
3. intro
 
Linux Command.pptx
Linux Command.pptxLinux Command.pptx
Linux Command.pptx
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.ppt
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structure
 
Linux week 2
Linux week 2Linux week 2
Linux week 2
 
Linux basic commands tutorial
Linux basic commands tutorialLinux basic commands tutorial
Linux basic commands tutorial
 
60761 linux
60761 linux60761 linux
60761 linux
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
Linux
LinuxLinux
Linux
 
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
 
Linux
LinuxLinux
Linux
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 

Recently uploaded

Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 

Recently uploaded (20)

Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 

Intro commandline

  • 1. Introducing theIntroducing the Command LineCommand Line CMSC 121 Introduction to UNIXCMSC 121 Introduction to UNIX Much of the material in these slides was taken fromMuch of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.Dan Hood’s CMSC 121 Lecture Notes.
  • 2. Format of UNIX CommandsFormat of UNIX Commands  UNIX commands can be very simple one word commands, or they can take aUNIX commands can be very simple one word commands, or they can take a number of additional arguments (parameters) as part of the command. Innumber of additional arguments (parameters) as part of the command. In general, a UNIX command has the following form:general, a UNIX command has the following form: command options(s) filename(s)command options(s) filename(s)  TheThe commandcommand is the name of the utility or program that we are going tois the name of the utility or program that we are going to execute.execute.  TheThe optionsoptions modify the way the command works. It is typical for these optionsmodify the way the command works. It is typical for these options to have be a hyphen followed by a single character, such asto have be a hyphen followed by a single character, such as -a-a. It is also a. It is also a common convention under Linux to have options that are in the form of 2common convention under Linux to have options that are in the form of 2 hyphens followed by a word or hyphenated words, such ashyphens followed by a word or hyphenated words, such as --color--color oror --pretty-print--pretty-print..  TheThe filenamefilename is the last argument for a lot of UNIX commands. It is simply theis 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 workfile or files that you want the command to work on. Not all commands work on files, such ason files, such as sshssh, which takes the name of a host as its argument., which takes the name of a host as its argument.
  • 3. Common UNIX ConventionsCommon UNIX Conventions  In UNIX, the command is almost alwaysIn UNIX, the command is almost always entered in allentered in all lowercaselowercase characters.characters.  Typically any options come before filenames.Typically any options come before filenames.  Many times, individual options may need a wordMany times, individual options may need a word after them to designate some additional meaningafter them to designate some additional meaning to the command.to the command.
  • 4. Familiar Commands:Familiar Commands: scp (Secure CoPy)scp (Secure CoPy)  TheThe scpscp command is a way to copy files backcommand is a way to copy files back and forth between multiple computers.and forth between multiple computers.  Formats for this command:Formats for this command:  scp path/local_name username@hostname:path/remote_namescp path/local_name username@hostname:path/remote_name  scp username@hostname:path/remote_name path/local_namescp username@hostname:path/remote_name path/local_name  Demo with renaming and copying files.Demo with renaming and copying files.
  • 5. Familiar Commands:Familiar Commands: ssh (Secure SHell)ssh (Secure SHell)  TheThe sshssh command is a way to securely connect to a remote computer.command is a way to securely connect to a remote computer.  Formats for this command:Formats for this command:  ssh hostnamessh hostname  ssh username@hostnamessh username@hostname  ssh hostname -l usernamessh hostname -l username  If you do not specify the username, it will assume that you want to connectIf 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.with the same username that you have on this local computer.  Since you have a single username for all computers on the OIT network, youSince you have a single username for all computers on the OIT network, you don’t need to explicitly enter a username.don’t need to explicitly enter a username.  But you can give a username, and will need to if your local username is differentBut 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 homethat 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.and set up your username to be different from what it is on GL.  Demo with connecting with different usernames.Demo with connecting with different usernames.
  • 6. Familiar Commands:Familiar Commands: ssh (Secure SHell)ssh (Secure SHell)  You can save a couple of keystrokes if you are on oneYou can save a couple of keystrokes if you are on one of the Linux PCs in the labs:of the Linux PCs in the labs:  You really only need to specify enough of a hostname as youYou really only need to specify enough of a hostname as you may need.may need.  Linux will automatically attempt to fill out the hostname withLinux will automatically attempt to fill out the hostname with “umbc.edu” for you.“umbc.edu” for you.  So if you want to log onto the lightest loaded linux server onSo if you want to log onto the lightest loaded linux server on gl, you only need to issue the following command...gl, you only need to issue the following command... ssh linux.glssh linux.gl  Or, if you don't care the flavor of UNIX, you can simplyOr, if you don't care the flavor of UNIX, you can simply type...type... ssh glssh gl
  • 7. Familiar Commands:Familiar Commands: passwd (change PASSWorD)passwd (change PASSWorD)  TheThe passwdpasswd command changes your UNIXcommand changes your UNIX password.password.  This command is an example of a “noThis command is an example of a “no argument” command. Thus, the format of thisargument” command. Thus, the format of this command is just the command name itself.command is just the command name itself. passwdpasswd  passwd is an interactive command, as once wepasswd is an interactive command, as once we have typed it, we need to interact with it.have typed it, we need to interact with it.
  • 8. Familiar Commands:Familiar Commands: quota (account QUOTA)quota (account QUOTA)  TheThe quotaquota command shows you how muchcommand shows you how much storage space you have left in your account.storage space you have left in your account.  When we use this command, we have to specifyWhen we use this command, we have to specify the -v option to get the information forthe -v option to get the information for ourour account.account.  The format of this command is:The format of this command is: quota -vquota -v
  • 9. Familiar Commands:Familiar Commands: oitcleaner (account cleaning tool)oitcleaner (account cleaning tool)  TheThe oitcleaneroitcleaner account cleaning tool wasaccount cleaning tool was developed by the UMBC OIT department.developed by the UMBC OIT department.  This command is specific to the UMBC GL systems.This command is specific to the UMBC GL systems.  This command takes no options and noThis command takes no options and no filenames, so its format is:filenames, so its format is: oitcleaneroitcleaner
  • 10. Man PagesMan Pages  TheThe manman command allows you to access thecommand allows you to access the MANual pages for a UNIX command.MANual pages for a UNIX command.  To get additional help on any of the commandsTo get additional help on any of the commands listed below, you can always typelisted below, you can always type manman name_of_commandname_of_command at the command prompt.at the command prompt.  Examples:Examples:  man sshman ssh  man passwdman passwd
  • 11. CommandsCommands  ls :ls : lists the contents of a directorylists the contents of a directory  l : long directory listingl : long directory listing  a : lists all files, including files which are normally hiddena : lists all files, including files which are normally hidden  F : distinguishes between directories and regular filesF : distinguishes between directories and regular files  h : ? Look it up usingh : ? Look it up using manman  pwdpwd : prints the current working directory: prints the current working directory  cdcd : changes directories: changes directories  The difference between relative and absolute paths.The difference between relative and absolute paths.  Special charactersSpecial characters ..,, ...., and, and ~~..  mkdirmkdir : creates a directory: creates a directory  rmdirrmdir : removes a directory (assuming it is empty): removes a directory (assuming it is empty)  If you get an error that the directory isn’t empty even though it looksIf you get an error that the directory isn’t empty even though it looks empty, check for hidden files.empty, check for hidden files.
  • 12. CommandsCommands  touchtouch : creates an empty file with the specified name,: creates an empty file with the specified name, or if the file already exists it modifies the timestamp.or if the file already exists it modifies the timestamp.  rmrm : removes a file.: removes a file.  f : force deletionf : force deletion  r : recursive deletionr : recursive deletion  mvmv - moves a file, or renames a file- moves a file, or renames a file  f : forces overwrite, if the destination file existsf : forces overwrite, if the destination file exists  cpcp - copies a file, leaving the original intact- copies a file, leaving the original intact  f : forces overwrite, if the destination file existsf : forces overwrite, if the destination file exists  r : recursive copying of directoriesr : recursive copying of directories
  • 13. CommandsCommands  catcat : shows the contents of a file, all at once: shows the contents of a file, all at once  moremore : shows the contents of a file, screen by: shows the contents of a file, screen by screenscreen  lessless : also shows the contents of a file, screen by: also shows the contents of a file, screen by screenscreen  headhead : used to show so many lines form the top: used to show so many lines form the top of a fileof a file  tailtail : used to show so many lines form the: used to show so many lines form the bottom of a filebottom of a file
  • 14. CommandsCommands  lprlpr : prints a file: prints a file  aliasalias :: creates an alias for a command.creates an alias for a command.  Aliases can be placed in yourAliases can be placed in your .cshrc.cshrc login script.login script.  Example: alias rm ‘rm –i’.Example: alias rm ‘rm –i’.  datedate : shows the date and time on the current system: shows the date and time on the current system  whowho : used to print out a list of users on the current: used to print out a list of users on the current systemsystem  hostnamehostname : prints the hostname of the current: prints the hostname of the current computercomputer  whoamiwhoami : prints your current username: prints your current username
  • 15. The UNIX Pipe (|)The UNIX Pipe (|)  The pipe (|) creates a channel from one command to another.The pipe (|) creates a channel from one command to another. Think of the pipe as a way of connecting the output from oneThink of the pipe as a way of connecting the output from one command to the input of another command.command to the input of another command.  The pipe can be used to link commands together to performThe pipe can be used to link commands together to perform more complex tasks that would otherwise take multiple stepsmore complex tasks that would otherwise take multiple steps (and possibly writing information to disk).(and possibly writing information to disk).  Examples:Examples:  Count the number of users logged onto the current system.Count the number of users logged onto the current system.  TheThe whowho command will give us line by line output of all the current users.command will give us line by line output of all the current users.  We could then use theWe could then use the wc -lwc -l to count the number of lines...to count the number of lines...  who | wc –lwho | wc –l  Display long listings in a scrollable page.Display long listings in a scrollable page.  TheThe lpqlpq command will give us a list of the waiting print jobs.command will give us a list of the waiting print jobs.  lpq | lesslpq | less
  • 16.
  • 17. CommandsCommands  psps : lists the processes running on the machine.: lists the processes running on the machine.  ps -ups -u usernameusername lists only your processes.lists only your processes.  ps -aps -a : lists all processes running on the machine.: lists all processes running on the machine.  The PID column of the listing, provides the informationThe PID column of the listing, provides the information required by the kill command.required by the kill command.  killkill : terminates a process: terminates a process  killkill process_idprocess_id : sends a terminate signal to the process: sends a terminate signal to the process specified by thespecified by the process_idprocess_id (PID).(PID).  In cases where the terminate signal does not work, theIn cases where the terminate signal does not work, the command "command "killkill -9-9 process_idprocess_id" sends a kill signal to the process." sends a kill signal to the process.  nicenice : runs a process with a lower priority.: runs a process with a lower priority.