SlideShare a Scribd company logo
1 of 3
Download to read offline
Unix Commands
                                                   Unix                                                                 January 2003

This quick reference lists commands, including a syntax diagram      2. Commands
and brief description. […] indicates an optional part of the         2.1. Command-line Special Characters
command. For more detail, use:
                                                                         Quotes and Escape
   man command                                                       Join Words                                                 "…"
Use man tcsh for the command language.                               Suppress Filename, Variable Substitution                   '…'
                                                                     Escape Character                                             
1. Files
                                                                       Separation, Continuation
1.1. Filename Substitution                                           Command Separation                                            ;
Wild Cards                                                 ? *       Command-Line Continuation (at end of line)                    
Character Class (c is any single character)              [c…]
   Range                                                 [c-c]       2.2. I/O Redirection and Pipes
Home Directory                                                ~      Standard Output                                              >
Home Directory of Another User                            ~user          (overwrite if exists)                                  >!
List Files in Current Directory                        ls [-l]       Appending to Standard Output                               >>
List Hidden Files                                     ls -[l]a       Standard Input                                               <
                                                                     Standard Error and Output                                  >&
1.2. File Manipulation                                               Standard Error Separately
Display File Contents                          cat filename                                    ( command > output ) >& errorfile
Copy                                   cp source destination         Pipes/ Pipelines                   command | filter [ | filter]
Move (Rename)                          mv oldname newname               Filters
Remove (Delete)                                 rm filename          Word/Line Count                                         wc [-l]
Create or Modify file                        pico filename           Last n Lines                                         tail [-n]
                                                                     Sort lines                                           sort [-n]
1.3. File Properties
                                                                     Multicolumn Output                                       pr -t
Seeing Permissions                                ls -l filename     List Spelling Errors                                   ispell
Changing Permissions                      chmod nnn filename
                                chmod c=p…[,c=p…] filename           2.3. Searching with grep
   n, a digit from 0 to 7, sets the access level for the user        grep Command                       grep "pattern" filename
   (owner), group, and others (public), respectively. c is one of:                                    command | grep "pattern"
   u–user; g–group, o–others, or a–all. p is one of: r–read             Search Patterns
   access, w–write access, or x–execute access.                            beginning of line                                     ^
Setting Default Permissions                            umask ugo           end of line                                           $
   ugo is a (3-digit) number. Each digit restricts the default             any single character                                  .
   permissions for the user, group, and others, respectively.              single character in list or range                   […]
Changing Modification Time                     touch filename              character not in list or range                     [^…]
Making Links                        ln [-s] oldname newname                zero or more of preceding char. or pattern            *
Seeing File Types                                           ls -F          zero or more of any character                        .*
1.4. Displaying a File with less                                           escapes special meaning                               

Run less                                       less filename
                                                                     3. C-Shell Features.
  Next line                                               RETURN
  Next Page                                                SPACE
                                                                     3.1 History Substitution
  Previous line                                                k     Repeat Previous Command                                      !!
  Previous Page                                                b     Commands Beginning with str                                !str
                                                                     Commands Containing str                                 !?str[?]
1.5. Directories                                                     All Arguments to Prev. Command                               !*
Change Directory                                 cd directory
                                                                         Word Designators
Make New Directory                            mkdir directory        All Arguments                                                :*
Remove Directory                              rmdir directory        Last Argument                                                :$
Print Working (Show Current) Directory                   pwd         First Argument                                               :^
                                                                     n'th Argument                                                :n
Arguments x Through y                                      :x-y      Standard Commands                               whereis file
    Modifiers                                                        Aliases and Commands                          which command
Print Command Line                                          :p       Describe Command                             whatis command
Substitute Command Line                             :[g]s/l/r/       Searching Out Files          find dir -name name -print
                                                                        dir is a directory name within which to search.
3.2 Aliases                                                             name is a filename to search for.
alias Command                     alias name 'definition'
                                                                     6.2. Finding Changes
   definition can contain escaped history substitution event
and                                                                  Comparing Files                              diff leftfile rightfile
word designators as placeholders for command-line arguments.           diff prefixes a less-than (<) to selected lines from leftfile
                                                                       and a greater-than (>) to lines from rightfile.
3.3. Variable Substitution
Creating a Variable                                     set var      6.3. Automating Tasks
Assigning a Value                              set var = value       Create a Makefile                           pico Makefile
Expressing a Value                                            $var      A makefile consists of macro definitions and targets.
Displaying a Value                                   echo $var       Test Makefile                               make -n [target]
   value is a single word, an expression in quotes, or an            Run make                                        make [target]
   expression that results in a single word after variable,
                                                                     6.4. Managing Disk Usage
   filename and command substitution takes place.
Assigning a List                                set var = (list)     Check Quota                                             quota -v
   list is a space-separated list of words, or an expression that    Seeing Disk Usage                                             df
   results in a space-separated list.                                                                                           du -s
Selecting the n'th Item                                   $var[n]
                                                                     6.5. Combining and Compressing Files
Selecting all Items                                          $var
Selecting a Range                                       $var[x-y]    Create a tarfile         tar cf file.tar file1 file2 … fileN
Item Count                                                  $#var       tar combines files but does not compress
                                                                     Create a zipfile                              zip filename
3.4 foreach Lists                                                    Unzip a file                                unzip filename
Start foreach Loop                         foreach var (list)
   foreach prompts for commands to repeat for each item in           7. Printing
   list (with >), until you type end. Within   the loop, $var        7.1 Formatting Output for Printing
   stands for the current item in list.                              Paginate with Page Headers                          pr filename
                                                                        in n columns                                  pr -n filename
3.5. Command Substitution
                                                                     Format for Laser Printer                          tex document
Replace Command with its Output on Command Line            `…`
                                                                     7.2 The Printer Queue
3.6 Job Control
                                                                     Print a File                                lp [-dpr] filename
Run Command in the Background                                  &                                                    lpcae filename
Stop Foreground Job                                       CTRL-Z     Check Quota                                           lpquot
List of Background Jobs                                    jobs      List Queue                                                 lpq
Bring Job Forward                                            %[n]    Stop Job                                                  lprm
Resume Job in Background                                  %[n] &
                                                                     8. Miscellaneous
4. Processes
                                                                     8.1 Miscellaneous Commands
Listing                                            ps [-[ef]]
Terminating                                     kill [-9] PID        List Commands for Subject                        man -k subject
Timing                                            time command       Display Current Date and Time                            date
   time is a number up to 4 digits. script is the name   of a file   Log off                                                  exit
   containing the command line(s) to perform.                        Electronic Mail                                          pine
                                                                     Display Documentation                             man command
5. Users
                                                                     8.2 Control Keys
Seeing Who is Logged In                                   who
                                                                     Abort Program                                                CTRL-C
                                                            w
                                                                     Backspace (Delete Last Character)                            CTRL-H
Seeing Your User Name                                  whoami        Pause Display on Screen                                      CTRL-S
                                                                     Resume Display after CTRL-S                                  CTRL-Q
6. Managing Files                                                    Send Job to Background                      CTRL-Z   followed by bg
6.1. Looking Up Files
Is this document clear? Is it missing crucial information?
   Please mail comments to the handout editor, CAE,
 1410 Engineering Drive, or to: editor@engr.wisc.edu

More Related Content

What's hot (14)

Unix reference sheet
Unix reference sheetUnix reference sheet
Unix reference sheet
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
58518522 study-aix
58518522 study-aix58518522 study-aix
58518522 study-aix
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Unix cmd
Unix cmdUnix cmd
Unix cmd
 
Doscommands
DoscommandsDoscommands
Doscommands
 
Os lab manual
Os lab manualOs lab manual
Os lab manual
 
Rf介绍
Rf介绍Rf介绍
Rf介绍
 
Commands
CommandsCommands
Commands
 
Unix practical file
Unix practical fileUnix practical file
Unix practical file
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
Chapter 4 Linux Basic Commands
Chapter 4 Linux Basic CommandsChapter 4 Linux Basic Commands
Chapter 4 Linux Basic Commands
 
101 3.1 gnu and unix commands
101 3.1 gnu and unix commands101 3.1 gnu and unix commands
101 3.1 gnu and unix commands
 

Viewers also liked

Basic command ppt
Basic command pptBasic command ppt
Basic command ppt
Rohit Kumar
 
Unix command-line tools
Unix command-line toolsUnix command-line tools
Unix command-line tools
Eric Wilson
 
Top 100 Linux Interview Questions and Answers 2014
Top 100 Linux Interview Questions and Answers 2014Top 100 Linux Interview Questions and Answers 2014
Top 100 Linux Interview Questions and Answers 2014
iimjobs and hirist
 

Viewers also liked (16)

Unix short
Unix shortUnix short
Unix short
 
Linux Command Line Basics
Linux Command Line BasicsLinux Command Line Basics
Linux Command Line Basics
 
Basic unix commands
Basic unix commandsBasic unix commands
Basic unix commands
 
Linux Command Suumary
Linux Command SuumaryLinux Command Suumary
Linux Command Suumary
 
Java For beginners and CSIT and IT students
Java  For beginners and CSIT and IT studentsJava  For beginners and CSIT and IT students
Java For beginners and CSIT and IT students
 
Java Notes
Java NotesJava Notes
Java Notes
 
Unix command line concepts
Unix command line conceptsUnix command line concepts
Unix command line concepts
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testing
 
Basic command ppt
Basic command pptBasic command ppt
Basic command ppt
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
 
Unix command-line tools
Unix command-line toolsUnix command-line tools
Unix command-line tools
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 
Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674
 
Java SE 8 best practices
Java SE 8 best practicesJava SE 8 best practices
Java SE 8 best practices
 
Top 100 Linux Interview Questions and Answers 2014
Top 100 Linux Interview Questions and Answers 2014Top 100 Linux Interview Questions and Answers 2014
Top 100 Linux Interview Questions and Answers 2014
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
 

Similar to Unix

Lecture1 3 shells
Lecture1 3 shellsLecture1 3 shells
Lecture1 3 shells
nghoanganh
 
Basic basic solaris quick referent card
Basic basic solaris quick referent cardBasic basic solaris quick referent card
Basic basic solaris quick referent card
Bui Van Cuong
 
gnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheetgnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheet
linkedinstaging
 
gnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheetgnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheet
linkedinstaging
 
gnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheetgnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheet
linkedinstaging
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
Nikhil Jain
 
List command linux a z
List command linux a zList command linux a z
List command linux a z
Jinyuan Loh
 
An a z index of the bash commands
An a z index of the bash commandsAn a z index of the bash commands
An a z index of the bash commands
Ben Pope
 

Similar to Unix (20)

Lecture1 3 shells
Lecture1 3 shellsLecture1 3 shells
Lecture1 3 shells
 
Basic basic solaris quick referent card
Basic basic solaris quick referent cardBasic basic solaris quick referent card
Basic basic solaris quick referent card
 
gnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheetgnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheet
 
gnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheetgnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheet
 
gnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheetgnu-coreutils-cheat-sheet
gnu-coreutils-cheat-sheet
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Quick guide of the most common linux commands
Quick guide of the most common linux commandsQuick guide of the most common linux commands
Quick guide of the most common linux commands
 
archive A-Z linux
archive A-Z linuxarchive A-Z linux
archive A-Z linux
 
Unix Trainning Doc.pptx
Unix Trainning Doc.pptxUnix Trainning Doc.pptx
Unix Trainning Doc.pptx
 
SHELL PROGRAMMING
SHELL PROGRAMMINGSHELL PROGRAMMING
SHELL PROGRAMMING
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Kali Linux Commands PDF-converted.pdf
Kali Linux Commands PDF-converted.pdfKali Linux Commands PDF-converted.pdf
Kali Linux Commands PDF-converted.pdf
 
Kali linux commands
Kali linux commandsKali linux commands
Kali linux commands
 
List command linux a z
List command linux a zList command linux a z
List command linux a z
 
Unix
UnixUnix
Unix
 
An a z index of the bash commands
An a z index of the bash commandsAn a z index of the bash commands
An a z index of the bash commands
 
unix_ref_card.pdf
unix_ref_card.pdfunix_ref_card.pdf
unix_ref_card.pdf
 
unix_ref_card.pdf
unix_ref_card.pdfunix_ref_card.pdf
unix_ref_card.pdf
 

More from Srinath Dhayalamoorthy

More from Srinath Dhayalamoorthy (11)

இசை கருவிகளின் வகைகள் Spring instruments
இசை கருவிகளின் வகைகள்   Spring instrumentsஇசை கருவிகளின் வகைகள்   Spring instruments
இசை கருவிகளின் வகைகள் Spring instruments
 
இசை கருவிகளின் வகைகள் - Wind instruments
இசை கருவிகளின் வகைகள் - Wind instrumentsஇசை கருவிகளின் வகைகள் - Wind instruments
இசை கருவிகளின் வகைகள் - Wind instruments
 
இசை கருவிகளின் வகைகள் - தோலிசைக் கருவிகள்
இசை கருவிகளின் வகைகள் - தோலிசைக் கருவிகள்இசை கருவிகளின் வகைகள் - தோலிசைக் கருவிகள்
இசை கருவிகளின் வகைகள் - தோலிசைக் கருவிகள்
 
Best weapon to tackle covid 19
Best weapon to tackle covid 19Best weapon to tackle covid 19
Best weapon to tackle covid 19
 
How coronavirus spread in the World?
How coronavirus spread in the World? How coronavirus spread in the World?
How coronavirus spread in the World?
 
IPC Section Part - 2 | Import Insurance to know | Offence and Punishment
IPC Section Part - 2 | Import Insurance to know | Offence and PunishmentIPC Section Part - 2 | Import Insurance to know | Offence and Punishment
IPC Section Part - 2 | Import Insurance to know | Offence and Punishment
 
IPC sections | Indian Sarais Act 1887
IPC sections | Indian Sarais Act 1887IPC sections | Indian Sarais Act 1887
IPC sections | Indian Sarais Act 1887
 
Fields of digital image processing slides
Fields of digital image processing slidesFields of digital image processing slides
Fields of digital image processing slides
 
Inheritance
InheritanceInheritance
Inheritance
 
Java applets
Java appletsJava applets
Java applets
 
Servers
ServersServers
Servers
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Unix

  • 1. Unix Commands Unix January 2003 This quick reference lists commands, including a syntax diagram 2. Commands and brief description. […] indicates an optional part of the 2.1. Command-line Special Characters command. For more detail, use: Quotes and Escape man command Join Words "…" Use man tcsh for the command language. Suppress Filename, Variable Substitution '…' Escape Character 1. Files Separation, Continuation 1.1. Filename Substitution Command Separation ; Wild Cards ? * Command-Line Continuation (at end of line) Character Class (c is any single character) [c…] Range [c-c] 2.2. I/O Redirection and Pipes Home Directory ~ Standard Output > Home Directory of Another User ~user (overwrite if exists) >! List Files in Current Directory ls [-l] Appending to Standard Output >> List Hidden Files ls -[l]a Standard Input < Standard Error and Output >& 1.2. File Manipulation Standard Error Separately Display File Contents cat filename ( command > output ) >& errorfile Copy cp source destination Pipes/ Pipelines command | filter [ | filter] Move (Rename) mv oldname newname Filters Remove (Delete) rm filename Word/Line Count wc [-l] Create or Modify file pico filename Last n Lines tail [-n] Sort lines sort [-n] 1.3. File Properties Multicolumn Output pr -t Seeing Permissions ls -l filename List Spelling Errors ispell Changing Permissions chmod nnn filename chmod c=p…[,c=p…] filename 2.3. Searching with grep n, a digit from 0 to 7, sets the access level for the user grep Command grep "pattern" filename (owner), group, and others (public), respectively. c is one of: command | grep "pattern" u–user; g–group, o–others, or a–all. p is one of: r–read Search Patterns access, w–write access, or x–execute access. beginning of line ^ Setting Default Permissions umask ugo end of line $ ugo is a (3-digit) number. Each digit restricts the default any single character . permissions for the user, group, and others, respectively. single character in list or range […] Changing Modification Time touch filename character not in list or range [^…] Making Links ln [-s] oldname newname zero or more of preceding char. or pattern * Seeing File Types ls -F zero or more of any character .* 1.4. Displaying a File with less escapes special meaning Run less less filename 3. C-Shell Features. Next line RETURN Next Page SPACE 3.1 History Substitution Previous line k Repeat Previous Command !! Previous Page b Commands Beginning with str !str Commands Containing str !?str[?] 1.5. Directories All Arguments to Prev. Command !* Change Directory cd directory Word Designators Make New Directory mkdir directory All Arguments :* Remove Directory rmdir directory Last Argument :$ Print Working (Show Current) Directory pwd First Argument :^ n'th Argument :n
  • 2. Arguments x Through y :x-y Standard Commands whereis file Modifiers Aliases and Commands which command Print Command Line :p Describe Command whatis command Substitute Command Line :[g]s/l/r/ Searching Out Files find dir -name name -print dir is a directory name within which to search. 3.2 Aliases name is a filename to search for. alias Command alias name 'definition' 6.2. Finding Changes definition can contain escaped history substitution event and Comparing Files diff leftfile rightfile word designators as placeholders for command-line arguments. diff prefixes a less-than (<) to selected lines from leftfile and a greater-than (>) to lines from rightfile. 3.3. Variable Substitution Creating a Variable set var 6.3. Automating Tasks Assigning a Value set var = value Create a Makefile pico Makefile Expressing a Value $var A makefile consists of macro definitions and targets. Displaying a Value echo $var Test Makefile make -n [target] value is a single word, an expression in quotes, or an Run make make [target] expression that results in a single word after variable, 6.4. Managing Disk Usage filename and command substitution takes place. Assigning a List set var = (list) Check Quota quota -v list is a space-separated list of words, or an expression that Seeing Disk Usage df results in a space-separated list. du -s Selecting the n'th Item $var[n] 6.5. Combining and Compressing Files Selecting all Items $var Selecting a Range $var[x-y] Create a tarfile tar cf file.tar file1 file2 … fileN Item Count $#var tar combines files but does not compress Create a zipfile zip filename 3.4 foreach Lists Unzip a file unzip filename Start foreach Loop foreach var (list) foreach prompts for commands to repeat for each item in 7. Printing list (with >), until you type end. Within the loop, $var 7.1 Formatting Output for Printing stands for the current item in list. Paginate with Page Headers pr filename in n columns pr -n filename 3.5. Command Substitution Format for Laser Printer tex document Replace Command with its Output on Command Line `…` 7.2 The Printer Queue 3.6 Job Control Print a File lp [-dpr] filename Run Command in the Background & lpcae filename Stop Foreground Job CTRL-Z Check Quota lpquot List of Background Jobs jobs List Queue lpq Bring Job Forward %[n] Stop Job lprm Resume Job in Background %[n] & 8. Miscellaneous 4. Processes 8.1 Miscellaneous Commands Listing ps [-[ef]] Terminating kill [-9] PID List Commands for Subject man -k subject Timing time command Display Current Date and Time date time is a number up to 4 digits. script is the name of a file Log off exit containing the command line(s) to perform. Electronic Mail pine Display Documentation man command 5. Users 8.2 Control Keys Seeing Who is Logged In who Abort Program CTRL-C w Backspace (Delete Last Character) CTRL-H Seeing Your User Name whoami Pause Display on Screen CTRL-S Resume Display after CTRL-S CTRL-Q 6. Managing Files Send Job to Background CTRL-Z followed by bg 6.1. Looking Up Files
  • 3. Is this document clear? Is it missing crucial information? Please mail comments to the handout editor, CAE, 1410 Engineering Drive, or to: editor@engr.wisc.edu