SlideShare a Scribd company logo
COMMAND LINE TOOLS
     by David T. Harris
Why?

 Efficiency
  No trying to find where an option is on a gui.
 Speed
  Barely any graphics -> little overhead.
 Ease of Use
  Generally simple one line commands
 Scriptable
  If you do have a sequence of commands to do
  you can place them in a script.
 Power
  Those one line commands can perform multiple tasks.
 Flexibility
  The abiliy to use multiple commands together.
  The ability to combine switches/options.
Finding Help

   Man pages
    man <programName>
   GNU Info
    info <programName>
   /usr/share/doc
    cd /usr/share/doc/<programName>
   --help or -help
    <programName> --help OR <programName> -help
   help
    When inside bash, just type help to see a list of bash topics bash can help you
    on.

Note: All of these options are not available with every program.
Moving Around
 Change Directory
  Directly
   cd </path/to/a/directory>/starting/from/the/root/directory>
   Example:

                            Let’s say that you’re currently in
                            /usr/share/doc/vim and you want to go into
                            /usr/share/doc/w3m
                            Then you would issue:
                            cd /usr/share/doc/w3m
  Relatively
   cd <nameOfAdirectoryInYourCurrentDirectory>
   cd ../<nameOfAdirectoryInYourParent’sDirectory>
   Example:
                          Let’s say that you’re currently in
                          /usr/share/doc/vim and you want to go into
                          /usr/share/doc/w3m
                          Then you would issue:
                          cd ../w3m
Usefull symbols
/
      Your root directory if positioned at the beginning of a path.
      A directory dividor if placed after the beginning of a path.
.
      Your current directory
..
      Your parent directory
~
      Your home directory
pwd
      A command that shows you the value of your current working directory
-
      A symbol that stands for your previous working directory
      Example:
           If you wanted to go to your previous working directory you would issue:
           cd -
Viewing Files
 ls (list)
  -l
    long listing (lists file permissions, owernship, size, date, time, & name )
  -h
    list the filesizes in human readable format (MB, KB, etc...)
    Must be used in conjunction with "-s" or "-l"
  -t
    list according to last accessed time (date)
  -i
    list the inode values
 List hidden files
  ls -d .*
 List hidden directories
  ls -d .*/
 List directory files recursively (WARNING: List may be very long)
  ls -R
File Information
 file
  Gives the true identity of a file.
  This can be very usefull since in *NIX most files don’t need extentions.
  Note: Some programs (like gcc) will only work correctly on files with a specific
  extention.
 stat
  Gives a good amount of information on a file including the last acces, modified,
  and changed time.
  Example: stat .bashrc
  Note: See man 2 stat(Programmer man section) for the differences in modified
  (mtime) and changed times (ctime)
Executable Program information
 type
  It tells you if the passed in program name is an alias, function, builtin command,
  reserved word, disk file, or not found.
 ldd
  This program tells you all the shared libraries that a program uses when it’s
  executed.
  Note: If a library does not show up in the output, and you know that you just
  recently installed it, you probably should run ldconfig to have the computer
  configure your installed shared libraries.
Wildcards
 *
     Lists 0 or more matching characters.
 ?
     List 0 or 1 matching characters.
 Globbing []
     Example:
      List all files beginning with the word bob and ending with a digit.
                                  ls bob*[0-9]
                                  ls bob*[0123456789]
     Note: Globbing does not work with the first dot in hidden files.
     Reference:
      http://www.faqs.org/docs/abs/HTML/globbingref.html
Change File Permissions (chmod) Part 1
 4
     Read only access (r)
 2
     Write only access (w)
 1
     Exectable Only access (x)
 0
     No permission to do anything.

 You add the first 3 numbers together to decide what permission
 value you wish for a single set of permissions for a file.
 There are 3 sets of these values for every file.
chmod Part 2
When you do an ls -l on a file you’ll see something like
   -rwxr-x-w-

From left to right these sets are as follows:
  1. Owner permissions
     These are the permissions that dictate what the
     owner can do to a file.
   2. Group permissions
     These are the permissions that dictate what everyone in the same group as the
     owner, can do with a file.
   3. World permissions
     These are the settings that everyone else (that is not the owner of the file, and
     is not in the same group as the owner of the file) can do with a file.
chmod - Part 3
Examples:

  If you want only yourself to be able to read, write and execute a
  file, but you want everyone in your group to only read and
  execute the file, and everyone else to just execute the file, then
  you’d set:
  chmod 751 <file>
Change File Ownership (chown)
 When you do an ls -l, after you see the permissions of a file you’ll
 see the owner of the file followed by the group of the file.
 If you wish to change either the "owner" or the "group" of the file",
 you can do so by using chown.

 Example1: Say you have a file that is owned by root, and has a
 group of root. You wish to change the file’s ownership such that
 user "bob" owns it, and that it belongs to the group "users".

  chown bob:users <file>
Chown (Continued)
 If you just want to change the group you would do:
  chown :users <file>
 Similarly if you just want to change the owner you would do:
  chown bob <file>

 Note: You might have to be su’d to root to perform some of these
 operations.
Copying Files (cp)

 To a different directory
  cp <fileToCopy> </path/>
  Example:
   cp ~/.bashrc ~/DOCS/Defaults/
   Note: In this example a DOCS/Defaults directory needs to exist in your home directory.


 To another file
  cp <fileToCopy> <copyOfOriginalFile>
  Example:
   cp ~/.bashrc ~/.bashrc-orig
 Note: If you do not have "cp -i" set up as an alias in your
 configuration file, you may accidentally overrwite a prexisting file.
Moving Files (mv)

 To a different directory
  mv <fileToMove> </path/>
  Example:
   mv ~/DOCS/.bashrc ~/DOCS/Defaults
   Note: In this example a DOCS/Defaults directory needs to exist in your home directory.


 To another file (renaming)
  mv <fileToRename> <renamedVerionOfOriginalFile>
  Example:
   mv ~/.bashrc-orig ~/.bashrc-March-3-2007
 Note: If you do not have "mv -i" set up as an alias in your
 configuration file, you may accidentally overrwite a prexisting file.
Deleting Files (USE WITH CAUTION!!)
 rm (Remove)
  Example: rm *~
  This will delete all of your the temporary files (made by vim) in your current
  directory.
 Note: When you start out using the rm command it is generally
 safe to put an alias "rm -i" into your shell’s configuration file. This
 will prevent you from accidentally deleting a file forever. It is
 insanely hard and at times nearly impossible to retrieve files once
 they’ve been rm’d.
Making Directories

 Make a new directory in your current directory
  mkdir <nameOfNewDirectory>

 This command creates any directories missing on the path to the
 directory you wish to create.
 It does not do anything to preexisting directories.
  mkdir -p </path/to/a/new/dir/nameOfNewDirectory>
Deleting Directories
 rmdir (Remove directory)
  If you have an empty directory you want to delete you can use this.
  Example: rmdir ~/testDir
  If you have files in this directory it will tell you.

  Note: If you want to delete a directory with files, you have to do:
  rm -fr ~/testDir
   -f //force
   -r //recursively go through all subdirectories
Viewing Files
 cat
  cat ~/.bashrc

 Pagers (more is less)
  more
   more ~/.bashrc
  less
   less ~/.bashrc
Background Processes
At times it’s usefull to put processes in the background so that you can continue to
work at the command line.
 <command> &
  Place the command into the background.
 fg
  Brings the last command you backgrounded into the foreground
 jobs
  Lists your backgrounded processes.
 Note: If you have more than 1 process backgrounded, and you
 wish to foreground a process other than the last process you
 backgrounded, you can do so, by specifying the job number.
Finding files
 locate
  Locate keeps a database file on your computer which maintains the locate of
  files on your computer.
  In order to find something using locate you’d type:
   locate <somePieceOfAFilename>
  Example: locate vim
  Note: If your computer doesn’t already, you should update your locate database
  on a regular basis, to prevent locate searches from returning invalid or old/stale
  information.

 Updating your locate database:
  1. su to root
  2. updatedb &
  Note: The & puts the process in the background.
  If you wish to bring it back to the foreground
  type fg
find
 At time locate might not be able to find a file that you recently
 created, if you haven’t already updated your database since
 creating the file. Also locate at times doesn’t include certain
 directories (like mounted directories ).
 Hence we’d want to use find.
  Say we want to find all files that begin with the word bob starting from our
  current directory and including all subdirectories. We’d issue:
   Example find . -iname "bob*"
                           -iname //case insensitive filename
                           .//current directory
which and whereis
which
  This tells you the path of an executable file
    Example: which ls
whereis
  This will also tell you the path of an executable file, the location of
  it’s man page, and the locations of it’s src file (if available).
    Example: whereis ls
Finding text in files using grep
 grep (GNU Regular Expression Parser)

 If you want to find text in files than you want to use grep.

 Example:
  grep -ril ’default’ *
  This will look at every normal file in your current directory and it’s subdirectories
  for the string ’default’ in all of it’s possible cases.
   -r //recursive
   -i //case insensitive
   -l //only list the filename - not the line of the file where the pattern was found.
Combining commands using |
 How it works:
  When two programs are separated by a pipe, the output of the first program
  becomes the input of the second program.

 Example:
  ls and less
   At times a directory listing can span multiple pages, in this case in order to go through the output without
   paging up you’d:
   ls|less
  locate and grep
   Say you want to find vim files on your computer
   but only in /usr then you’d do something like:
   locate vim|grep /usr
Becoming a different user
 su
  This allows you to be a different user. By default it allows you to become root.
  Once you execute "su" you’ll need to enter that other users password. By
  default you’ll have to enter root’s password.
  Example:
   su bob
 su -
  This will inherit the path of the user you’re becoming.
  Example:
   su - bob
Viewing processes
 ps
  Just view your own processes running in your shell.
 ps aux
  View all processes
 top
  View all processes
 pgrep -lf <nameOfProcess>
  Search the group of running processes for <nameOfProcess>
Stopping/killing processes
 kill <pidOfAProcessYouWishToKill>
  Example: kill 1501

  -9 <pidOfAProcessYouWishToKill>
   Example: kill -9 1501


 killall <nameOfprocess>
  Example:
   killall firefox
 pkill <nameOfprocess>
  Example:
   pkill firefox
   pkill -9 firefox


 Note: The -9 switch should only be used for obstinate processes
 which just won’t stop running.
Finding information about your computer
 /proc
  This has a series of directories that contain various information on your system
  including memory, what processes are running, etc...
 dmesg
  This is a very usefull tool to diagnose problems with devices on your system.
  This is a standard unix tool, whereas /proc is being eliminated from the default
  install for most *BSD OS’s.
 lspci -v
  This is a linux tool. It displays the device attached to your system (graphics
  card, network controller, etc...)
  Note: In order to see some information you have to be root.

More Related Content

What's hot

Compression
CompressionCompression
Compression
aswathyu
 
MCLS 45 Lab Manual
MCLS 45 Lab ManualMCLS 45 Lab Manual
MCLS 45 Lab Manual
Lokesh Singrol
 
Linux ppt
Linux pptLinux ppt
Linux ppt
Sanmuga Nathan
 
Linux
LinuxLinux
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
BITS
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystem
root_fibo
 
Treebeard's Unix Cheat Sheet
Treebeard's Unix Cheat SheetTreebeard's Unix Cheat Sheet
Treebeard's Unix Cheat Sheet
wensheng wei
 
Managing your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformaticsManaging your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformatics
BITS
 
Linux commands
Linux commands Linux commands
Linux commands
debashis rout
 
Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands
Ahmed El-Arabawy
 
Linux commands
Linux commandsLinux commands
Linux commands
VenkatakrishnaAdari1
 
Basic commands of linux
Basic commands of linuxBasic commands of linux
Basic commands of linux
shravan saini
 
Unix Basics 04sp
Unix Basics 04spUnix Basics 04sp
Unix Basics 04sp
Dr.Ravi
 
Unit 12 finding and processing files
Unit 12 finding and processing filesUnit 12 finding and processing files
Unit 12 finding and processing files
root_fibo
 
Compression Commands in Linux
Compression Commands in LinuxCompression Commands in Linux
Compression Commands in Linux
Pegah Taheri
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
Shay Cohen
 
Linux class 8 tar
Linux class 8   tar  Linux class 8   tar
Hadoop Interacting with HDFS
Hadoop Interacting with HDFSHadoop Interacting with HDFS
Hadoop Interacting with HDFS
Apache Apex
 
Basic Linux commands
Basic Linux commandsBasic Linux commands
Basic Linux commands
atozknowledge .com
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files
Ahmed El-Arabawy
 

What's hot (20)

Compression
CompressionCompression
Compression
 
MCLS 45 Lab Manual
MCLS 45 Lab ManualMCLS 45 Lab Manual
MCLS 45 Lab Manual
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Linux
LinuxLinux
Linux
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystem
 
Treebeard's Unix Cheat Sheet
Treebeard's Unix Cheat SheetTreebeard's Unix Cheat Sheet
Treebeard's Unix Cheat Sheet
 
Managing your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformaticsManaging your data - Introduction to Linux for bioinformatics
Managing your data - Introduction to Linux for bioinformatics
 
Linux commands
Linux commands Linux commands
Linux commands
 
Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Basic commands of linux
Basic commands of linuxBasic commands of linux
Basic commands of linux
 
Unix Basics 04sp
Unix Basics 04spUnix Basics 04sp
Unix Basics 04sp
 
Unit 12 finding and processing files
Unit 12 finding and processing filesUnit 12 finding and processing files
Unit 12 finding and processing files
 
Compression Commands in Linux
Compression Commands in LinuxCompression Commands in Linux
Compression Commands in Linux
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
 
Linux class 8 tar
Linux class 8   tar  Linux class 8   tar
Linux class 8 tar
 
Hadoop Interacting with HDFS
Hadoop Interacting with HDFSHadoop Interacting with HDFS
Hadoop Interacting with HDFS
 
Basic Linux commands
Basic Linux commandsBasic Linux commands
Basic Linux commands
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files
 

Viewers also liked

Van luong.blogspot.com sony
Van luong.blogspot.com sonyVan luong.blogspot.com sony
Van luong.blogspot.com sony
Toan Vu Quang
 
יחידת שליטה עצמאית‬ - ‫גלאי תנועה לחיסכון
יחידת שליטה עצמאית‬ - ‫גלאי תנועה לחיסכוןיחידת שליטה עצמאית‬ - ‫גלאי תנועה לחיסכון
יחידת שליטה עצמאית‬ - ‫גלאי תנועה לחיסכון
tomtom30
 
Weekof feb17thcollaborativeplanning6thgrade
Weekof feb17thcollaborativeplanning6thgradeWeekof feb17thcollaborativeplanning6thgrade
Weekof feb17thcollaborativeplanning6thgrade
Katie K
 
Lori Fagien Cv Presentation
Lori Fagien Cv PresentationLori Fagien Cv Presentation
Lori Fagien Cv Presentation
guest7d4ad21
 
Ulasan Buku
Ulasan BukuUlasan Buku
Ulasan Buku
adaz
 
Seller servicespresentation
Seller servicespresentationSeller servicespresentation
Seller servicespresentation
TeamGilreath
 
클라우드 컴퓨팅 및 N-screen (2011년)
클라우드 컴퓨팅 및 N-screen (2011년)클라우드 컴퓨팅 및 N-screen (2011년)
클라우드 컴퓨팅 및 N-screen (2011년)훈주 윤
 
\\Moladmdc2\Home$\Olssonj\My Documents\University\Ict &amp; Pedagogy\Learning...
\\Moladmdc2\Home$\Olssonj\My Documents\University\Ict &amp; Pedagogy\Learning...\\Moladmdc2\Home$\Olssonj\My Documents\University\Ict &amp; Pedagogy\Learning...
\\Moladmdc2\Home$\Olssonj\My Documents\University\Ict &amp; Pedagogy\Learning...
Jenny Olsson
 
M2M Presentation at Telecom Council of Silicon Valley
M2M Presentation at Telecom Council of Silicon ValleyM2M Presentation at Telecom Council of Silicon Valley
M2M Presentation at Telecom Council of Silicon Valley
Daniel Kellmereit
 
Trucs De Grand Mere
Trucs De Grand MereTrucs De Grand Mere
Trucs De Grand Merechris2256
 
Self healing-systems
Self healing-systemsSelf healing-systems
Self healing-systems
SKORDEMIR
 
동작인식 기술 및 활용 트렌드 (2013년)
동작인식 기술 및 활용 트렌드 (2013년)동작인식 기술 및 활용 트렌드 (2013년)
동작인식 기술 및 활용 트렌드 (2013년)
훈주 윤
 
Incubation
IncubationIncubation
Incubation
Daniel Kellmereit
 
스마트 디바이스 트렌드 및 전망 (2013년)
스마트 디바이스 트렌드 및 전망 (2013년)스마트 디바이스 트렌드 및 전망 (2013년)
스마트 디바이스 트렌드 및 전망 (2013년)
훈주 윤
 
증강현실 기술 및 활용 트렌드(2013년)
증강현실 기술 및 활용 트렌드(2013년)증강현실 기술 및 활용 트렌드(2013년)
증강현실 기술 및 활용 트렌드(2013년)
훈주 윤
 
IoT/웨어러블 디바이스에서의 동작인식 기술 및 활용분야 (2014년)
IoT/웨어러블 디바이스에서의 동작인식 기술 및 활용분야 (2014년)IoT/웨어러블 디바이스에서의 동작인식 기술 및 활용분야 (2014년)
IoT/웨어러블 디바이스에서의 동작인식 기술 및 활용분야 (2014년)
훈주 윤
 
St Ouen, Il y a un Siècle...
St Ouen, Il y a un Siècle...St Ouen, Il y a un Siècle...
St Ouen, Il y a un Siècle...
chris2256
 
IoT(사물인터넷) 제품 및 서비스 동향
IoT(사물인터넷) 제품 및 서비스 동향IoT(사물인터넷) 제품 및 서비스 동향
IoT(사물인터넷) 제품 및 서비스 동향
훈주 윤
 
Le Cheval Et La Poule
Le Cheval Et La PouleLe Cheval Et La Poule
Le Cheval Et La Poule
chris2256
 

Viewers also liked (20)

Van luong.blogspot.com sony
Van luong.blogspot.com sonyVan luong.blogspot.com sony
Van luong.blogspot.com sony
 
יחידת שליטה עצמאית‬ - ‫גלאי תנועה לחיסכון
יחידת שליטה עצמאית‬ - ‫גלאי תנועה לחיסכוןיחידת שליטה עצמאית‬ - ‫גלאי תנועה לחיסכון
יחידת שליטה עצמאית‬ - ‫גלאי תנועה לחיסכון
 
Weekof feb17thcollaborativeplanning6thgrade
Weekof feb17thcollaborativeplanning6thgradeWeekof feb17thcollaborativeplanning6thgrade
Weekof feb17thcollaborativeplanning6thgrade
 
Lori Fagien Cv Presentation
Lori Fagien Cv PresentationLori Fagien Cv Presentation
Lori Fagien Cv Presentation
 
Ulasan Buku
Ulasan BukuUlasan Buku
Ulasan Buku
 
Seller servicespresentation
Seller servicespresentationSeller servicespresentation
Seller servicespresentation
 
클라우드 컴퓨팅 및 N-screen (2011년)
클라우드 컴퓨팅 및 N-screen (2011년)클라우드 컴퓨팅 및 N-screen (2011년)
클라우드 컴퓨팅 및 N-screen (2011년)
 
\\Moladmdc2\Home$\Olssonj\My Documents\University\Ict &amp; Pedagogy\Learning...
\\Moladmdc2\Home$\Olssonj\My Documents\University\Ict &amp; Pedagogy\Learning...\\Moladmdc2\Home$\Olssonj\My Documents\University\Ict &amp; Pedagogy\Learning...
\\Moladmdc2\Home$\Olssonj\My Documents\University\Ict &amp; Pedagogy\Learning...
 
M2M Presentation at Telecom Council of Silicon Valley
M2M Presentation at Telecom Council of Silicon ValleyM2M Presentation at Telecom Council of Silicon Valley
M2M Presentation at Telecom Council of Silicon Valley
 
Bab 2
Bab 2Bab 2
Bab 2
 
Trucs De Grand Mere
Trucs De Grand MereTrucs De Grand Mere
Trucs De Grand Mere
 
Self healing-systems
Self healing-systemsSelf healing-systems
Self healing-systems
 
동작인식 기술 및 활용 트렌드 (2013년)
동작인식 기술 및 활용 트렌드 (2013년)동작인식 기술 및 활용 트렌드 (2013년)
동작인식 기술 및 활용 트렌드 (2013년)
 
Incubation
IncubationIncubation
Incubation
 
스마트 디바이스 트렌드 및 전망 (2013년)
스마트 디바이스 트렌드 및 전망 (2013년)스마트 디바이스 트렌드 및 전망 (2013년)
스마트 디바이스 트렌드 및 전망 (2013년)
 
증강현실 기술 및 활용 트렌드(2013년)
증강현실 기술 및 활용 트렌드(2013년)증강현실 기술 및 활용 트렌드(2013년)
증강현실 기술 및 활용 트렌드(2013년)
 
IoT/웨어러블 디바이스에서의 동작인식 기술 및 활용분야 (2014년)
IoT/웨어러블 디바이스에서의 동작인식 기술 및 활용분야 (2014년)IoT/웨어러블 디바이스에서의 동작인식 기술 및 활용분야 (2014년)
IoT/웨어러블 디바이스에서의 동작인식 기술 및 활용분야 (2014년)
 
St Ouen, Il y a un Siècle...
St Ouen, Il y a un Siècle...St Ouen, Il y a un Siècle...
St Ouen, Il y a un Siècle...
 
IoT(사물인터넷) 제품 및 서비스 동향
IoT(사물인터넷) 제품 및 서비스 동향IoT(사물인터넷) 제품 및 서비스 동향
IoT(사물인터넷) 제품 및 서비스 동향
 
Le Cheval Et La Poule
Le Cheval Et La PouleLe Cheval Et La Poule
Le Cheval Et La Poule
 

Similar to Command Line Tools

Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
nitin lakhanpal
 
Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
Mohamed Abubakar Sittik A
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.ppt
LuigysToro
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structure
Sreenatha Reddy K R
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
MeesanRaza
 
Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.
Tushar B Kute
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
Muhammad Qazi
 
Linux[122-150].pdf
Linux[122-150].pdfLinux[122-150].pdf
Linux[122-150].pdf
ZINEBAGOURRAM1
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
amitkamble79
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
Dheeraj Nambiar
 
Management file and directory in linux
Management file and directory in linuxManagement file and directory in linux
Management file and directory in linux
Zkre Saleh
 
Ppt
PptPpt
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
Dimas Prasetyo
 
Shell_Scripting.ppt
Shell_Scripting.pptShell_Scripting.ppt
Shell_Scripting.ppt
KiranMantri
 
Linux day 2.ppt
Linux day  2.pptLinux day  2.ppt
Linux day 2.ppt
Kalkey
 
Chapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptxChapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptx
alehegn9
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2
Gourav Varma
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
southees
 
Introduction to linux day1
Introduction to linux day1Introduction to linux day1
Introduction to linux day1
UtpalenduChakrobortt1
 
Linux commands
Linux commandsLinux commands
Linux commands
U.P Police
 

Similar to Command Line Tools (20)

Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
 
Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.ppt
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structure
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
 
Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
Linux[122-150].pdf
Linux[122-150].pdfLinux[122-150].pdf
Linux[122-150].pdf
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Management file and directory in linux
Management file and directory in linuxManagement file and directory in linux
Management file and directory in linux
 
Ppt
PptPpt
Ppt
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
 
Shell_Scripting.ppt
Shell_Scripting.pptShell_Scripting.ppt
Shell_Scripting.ppt
 
Linux day 2.ppt
Linux day  2.pptLinux day  2.ppt
Linux day 2.ppt
 
Chapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptxChapter 2 Linux File System and net.pptx
Chapter 2 Linux File System and net.pptx
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 
Introduction to linux day1
Introduction to linux day1Introduction to linux day1
Introduction to linux day1
 
Linux commands
Linux commandsLinux commands
Linux commands
 

Recently uploaded

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
Pixlogix Infotech
 

Recently uploaded (20)

GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website20 Comprehensive Checklist of Designing and Developing a Website
20 Comprehensive Checklist of Designing and Developing a Website
 

Command Line Tools

  • 1. COMMAND LINE TOOLS by David T. Harris
  • 2. Why? Efficiency No trying to find where an option is on a gui. Speed Barely any graphics -> little overhead. Ease of Use Generally simple one line commands Scriptable If you do have a sequence of commands to do you can place them in a script. Power Those one line commands can perform multiple tasks. Flexibility The abiliy to use multiple commands together. The ability to combine switches/options.
  • 3. Finding Help Man pages man <programName> GNU Info info <programName> /usr/share/doc cd /usr/share/doc/<programName> --help or -help <programName> --help OR <programName> -help help When inside bash, just type help to see a list of bash topics bash can help you on. Note: All of these options are not available with every program.
  • 4. Moving Around Change Directory Directly cd </path/to/a/directory>/starting/from/the/root/directory> Example: Let’s say that you’re currently in /usr/share/doc/vim and you want to go into /usr/share/doc/w3m Then you would issue: cd /usr/share/doc/w3m Relatively cd <nameOfAdirectoryInYourCurrentDirectory> cd ../<nameOfAdirectoryInYourParent’sDirectory> Example: Let’s say that you’re currently in /usr/share/doc/vim and you want to go into /usr/share/doc/w3m Then you would issue: cd ../w3m
  • 5. Usefull symbols / Your root directory if positioned at the beginning of a path. A directory dividor if placed after the beginning of a path. . Your current directory .. Your parent directory ~ Your home directory pwd A command that shows you the value of your current working directory - A symbol that stands for your previous working directory Example: If you wanted to go to your previous working directory you would issue: cd -
  • 6. Viewing Files ls (list) -l long listing (lists file permissions, owernship, size, date, time, & name ) -h list the filesizes in human readable format (MB, KB, etc...) Must be used in conjunction with "-s" or "-l" -t list according to last accessed time (date) -i list the inode values List hidden files ls -d .* List hidden directories ls -d .*/ List directory files recursively (WARNING: List may be very long) ls -R
  • 7. File Information file Gives the true identity of a file. This can be very usefull since in *NIX most files don’t need extentions. Note: Some programs (like gcc) will only work correctly on files with a specific extention. stat Gives a good amount of information on a file including the last acces, modified, and changed time. Example: stat .bashrc Note: See man 2 stat(Programmer man section) for the differences in modified (mtime) and changed times (ctime)
  • 8. Executable Program information type It tells you if the passed in program name is an alias, function, builtin command, reserved word, disk file, or not found. ldd This program tells you all the shared libraries that a program uses when it’s executed. Note: If a library does not show up in the output, and you know that you just recently installed it, you probably should run ldconfig to have the computer configure your installed shared libraries.
  • 9. Wildcards * Lists 0 or more matching characters. ? List 0 or 1 matching characters. Globbing [] Example: List all files beginning with the word bob and ending with a digit. ls bob*[0-9] ls bob*[0123456789] Note: Globbing does not work with the first dot in hidden files. Reference: http://www.faqs.org/docs/abs/HTML/globbingref.html
  • 10. Change File Permissions (chmod) Part 1 4 Read only access (r) 2 Write only access (w) 1 Exectable Only access (x) 0 No permission to do anything. You add the first 3 numbers together to decide what permission value you wish for a single set of permissions for a file. There are 3 sets of these values for every file.
  • 11. chmod Part 2 When you do an ls -l on a file you’ll see something like -rwxr-x-w- From left to right these sets are as follows: 1. Owner permissions These are the permissions that dictate what the owner can do to a file. 2. Group permissions These are the permissions that dictate what everyone in the same group as the owner, can do with a file. 3. World permissions These are the settings that everyone else (that is not the owner of the file, and is not in the same group as the owner of the file) can do with a file.
  • 12. chmod - Part 3 Examples: If you want only yourself to be able to read, write and execute a file, but you want everyone in your group to only read and execute the file, and everyone else to just execute the file, then you’d set: chmod 751 <file>
  • 13. Change File Ownership (chown) When you do an ls -l, after you see the permissions of a file you’ll see the owner of the file followed by the group of the file. If you wish to change either the "owner" or the "group" of the file", you can do so by using chown. Example1: Say you have a file that is owned by root, and has a group of root. You wish to change the file’s ownership such that user "bob" owns it, and that it belongs to the group "users". chown bob:users <file>
  • 14. Chown (Continued) If you just want to change the group you would do: chown :users <file> Similarly if you just want to change the owner you would do: chown bob <file> Note: You might have to be su’d to root to perform some of these operations.
  • 15. Copying Files (cp) To a different directory cp <fileToCopy> </path/> Example: cp ~/.bashrc ~/DOCS/Defaults/ Note: In this example a DOCS/Defaults directory needs to exist in your home directory. To another file cp <fileToCopy> <copyOfOriginalFile> Example: cp ~/.bashrc ~/.bashrc-orig Note: If you do not have "cp -i" set up as an alias in your configuration file, you may accidentally overrwite a prexisting file.
  • 16. Moving Files (mv) To a different directory mv <fileToMove> </path/> Example: mv ~/DOCS/.bashrc ~/DOCS/Defaults Note: In this example a DOCS/Defaults directory needs to exist in your home directory. To another file (renaming) mv <fileToRename> <renamedVerionOfOriginalFile> Example: mv ~/.bashrc-orig ~/.bashrc-March-3-2007 Note: If you do not have "mv -i" set up as an alias in your configuration file, you may accidentally overrwite a prexisting file.
  • 17. Deleting Files (USE WITH CAUTION!!) rm (Remove) Example: rm *~ This will delete all of your the temporary files (made by vim) in your current directory. Note: When you start out using the rm command it is generally safe to put an alias "rm -i" into your shell’s configuration file. This will prevent you from accidentally deleting a file forever. It is insanely hard and at times nearly impossible to retrieve files once they’ve been rm’d.
  • 18. Making Directories Make a new directory in your current directory mkdir <nameOfNewDirectory> This command creates any directories missing on the path to the directory you wish to create. It does not do anything to preexisting directories. mkdir -p </path/to/a/new/dir/nameOfNewDirectory>
  • 19. Deleting Directories rmdir (Remove directory) If you have an empty directory you want to delete you can use this. Example: rmdir ~/testDir If you have files in this directory it will tell you. Note: If you want to delete a directory with files, you have to do: rm -fr ~/testDir -f //force -r //recursively go through all subdirectories
  • 20. Viewing Files cat cat ~/.bashrc Pagers (more is less) more more ~/.bashrc less less ~/.bashrc
  • 21. Background Processes At times it’s usefull to put processes in the background so that you can continue to work at the command line. <command> & Place the command into the background. fg Brings the last command you backgrounded into the foreground jobs Lists your backgrounded processes. Note: If you have more than 1 process backgrounded, and you wish to foreground a process other than the last process you backgrounded, you can do so, by specifying the job number.
  • 22. Finding files locate Locate keeps a database file on your computer which maintains the locate of files on your computer. In order to find something using locate you’d type: locate <somePieceOfAFilename> Example: locate vim Note: If your computer doesn’t already, you should update your locate database on a regular basis, to prevent locate searches from returning invalid or old/stale information. Updating your locate database: 1. su to root 2. updatedb & Note: The & puts the process in the background. If you wish to bring it back to the foreground type fg
  • 23. find At time locate might not be able to find a file that you recently created, if you haven’t already updated your database since creating the file. Also locate at times doesn’t include certain directories (like mounted directories ). Hence we’d want to use find. Say we want to find all files that begin with the word bob starting from our current directory and including all subdirectories. We’d issue: Example find . -iname "bob*" -iname //case insensitive filename .//current directory
  • 24. which and whereis which This tells you the path of an executable file Example: which ls whereis This will also tell you the path of an executable file, the location of it’s man page, and the locations of it’s src file (if available). Example: whereis ls
  • 25. Finding text in files using grep grep (GNU Regular Expression Parser) If you want to find text in files than you want to use grep. Example: grep -ril ’default’ * This will look at every normal file in your current directory and it’s subdirectories for the string ’default’ in all of it’s possible cases. -r //recursive -i //case insensitive -l //only list the filename - not the line of the file where the pattern was found.
  • 26. Combining commands using | How it works: When two programs are separated by a pipe, the output of the first program becomes the input of the second program. Example: ls and less At times a directory listing can span multiple pages, in this case in order to go through the output without paging up you’d: ls|less locate and grep Say you want to find vim files on your computer but only in /usr then you’d do something like: locate vim|grep /usr
  • 27. Becoming a different user su This allows you to be a different user. By default it allows you to become root. Once you execute "su" you’ll need to enter that other users password. By default you’ll have to enter root’s password. Example: su bob su - This will inherit the path of the user you’re becoming. Example: su - bob
  • 28. Viewing processes ps Just view your own processes running in your shell. ps aux View all processes top View all processes pgrep -lf <nameOfProcess> Search the group of running processes for <nameOfProcess>
  • 29. Stopping/killing processes kill <pidOfAProcessYouWishToKill> Example: kill 1501 -9 <pidOfAProcessYouWishToKill> Example: kill -9 1501 killall <nameOfprocess> Example: killall firefox pkill <nameOfprocess> Example: pkill firefox pkill -9 firefox Note: The -9 switch should only be used for obstinate processes which just won’t stop running.
  • 30. Finding information about your computer /proc This has a series of directories that contain various information on your system including memory, what processes are running, etc... dmesg This is a very usefull tool to diagnose problems with devices on your system. This is a standard unix tool, whereas /proc is being eliminated from the default install for most *BSD OS’s. lspci -v This is a linux tool. It displays the device attached to your system (graphics card, network controller, etc...) Note: In order to see some information you have to be root.