SlideShare a Scribd company logo
1 of 6
Download to read offline
Some Basic UNIX Commands
                                    by Donald Hyatt

The UNIX operating system has for many years formed the backbone of the
Internet, especially for large servers and most major university campuses.
However, a free version of UNIX called Linux has been making significant gains
against Macintosh and the Microsoft Windows 95/98/NT environments, so often
associated with personal computers. Developed by a number of volunteers on the
Internet such as the Linux group and the GNU project, much of the open-source
software is copyrighted, but available for free. This is especially valuable for those
in educational environments where budgets are often limited.

UNIX commands can often be grouped together to make even more powerful
commands with capabilities known as I/O redirection ( < for getting input from a
file input and > for outputing to a file ) and piping using | to feed the output of one
command as input to the next. Please investigate manuals in the lab for more
examples than the few offered here.

The following charts offer a summary of some simple UNIX commands. These are
certainly not all of the commands available in this robust operating system, but
these will help you get started.

Ten ESSENTIAL UNIX Commands

These are ten commands that you really need to know in order to get started with
UNIX. They are probably similar to commands you already know for another
operating system.



    Command        Example                  Description

    1.   ls        ls                       Lists files in current directory
                   ls -alF                  List in long format

    2.   cd        cd tempdir               Change directory to tempdir
                   cd ..                    Move back one directory
                   cd ~dhyatt/web-docs      Move into dhyatt's web-docs directory

    3.   mkdir     mkdir graphics           Make a directory called graphics

    4.   rmdir     rmdir emptydir           Remove directory (must be empty)
5.   cp         cp file1 web-docs        Copy file into directory
                   cp file1 file1.bak       Make backup of file1

   6.   rm         rm file1.bak             Remove or delete file
                   rm *.tmp                 Remove all file

   7.   mv         mv old.html new.html     Move or rename files

   8.   more       more index.html          Look at file, one page at a time

   9.   lpr        lpr index.html           Send file to printer

   10. man         man ls                   Online manual (help) about command




Ten VALUABLE UNIX Commands

Once you have mastered the basic UNIX commands, these will be quite valuable in
managing your own account.



   Command                  Example                    Description

   1. grep                  grep "bad word" *          Find which files contain a
   <str><files>                                        certain word

   2. chmod <opt>           chmod 644 *.html           Change file permissions read
   <file>                   chmod 755 file.exe         only
                                                       Change file permissions to
                                                       executable

   3.   passwd              passwd                     Change passwd

   4.   ps <opt>            ps aux                     List all running processes by
                            ps aux | grep dhyatt       #ID
                                                       List process #ID's running by
                                                       dhyatt

   5.   kill <opt> <ID>     kill -9 8453               Kill process with ID #8453
6. gcc (g++)            gcc file.c -o file            Compile a program written in
   <source>                g++ fil2.cpp -o fil2          C
                                                         Compile a program written in
                                                         C++

   7.   gzip <file>        gzip bigfile                  Compress file
                           gunzip bigfile.gz             Uncompress file

   8.   mail               mail                          Send file1 by email to
        (pine)             me@tjhsst.edu < file1         someone
                           pine                          Read mail using pine

   9.   telnet <host>      telnet vortex.tjhsst.edu      Open a connection to vortex
        ssh <host>         ssh -l dhyatt                 Open a secure connection to
                           jazz.tjhsst.edu               jazz as user dhyatt

   10. ftp <host>          ftp station1.tjhsst.edu       Upload or Download files to
   ncftp                   ncftp metalab.unc.edu         station1
   <host/directory>                                      Connect to archives at UNC



Ten FUN UNIX Commands

These are ten commands that you might find interesting or amusing. They are
actually quite helpful at times, and should not be considered idle entertainment.



   Command               Example               Description

   1.   who              who                   Lists who is logged on your machine

   2.   finger           finger                Lists who is on computers in the lab

   3. ytalk              ytalk                 Talk online with dhyatt who is on threat
   <user@place>          dhyatt@threat

   4.   history          history               Lists commands you've done recently

   5.   fortune          fortune               Print random humerous message

   6.   date             date                  Print out current date

   7.   cal <mo> <yr>    cal 9 2000            Print calendar for September 2000
8.   xeyes             xeyes &               Keep track of cursor (in "background")

   9.   xcalc             xcalc &               Calculator ("background" process)

   10. mpage <opt>        mpage -8 file1        Print 8 pages on a single sheet and send
   <file>                  | lpr                to printer (the font will be small!)



Ten HELPFUL UNIX Commands

These ten commands are very helpful, especially with graphics and word
processing type applications.



   Command                     Example               Description

   1.   netscape               netscape &            Run Netscape browser

   2.   xv                     xv &                  Run graphics file converter

   3.   xfig / xpaint          xfig & (xpaint        Run drawing program
                               &)

   4.   gimp                   gimp &                Run photoshop type program

   5.   ispell <fname>         ispell file1          Spell check file1

   6.   latex <fname>          latex file.tex        Run LaTeX, a scientific document
                                                     tool

   7.   xemacs / pico          xemacs (or pico)      Different editors

   8.   soffice                soffice &             Run StarOffice, a full word
                                                     processor

   9. m-tools (mdir,           mdir a:               DOS commands from UNIX (dir
   mcopy,                      mcopy file1 a:        A:)
         mdel, mformat,                              Copy file1 to A:
   etc. )

   10. gnuplot                 gnuplot               Plot data graphically
Ten USEFUL UNIX Commands:

These ten commands are useful for monitoring system access, or simplifying your
own environment.



   Command           Example                  Description

   1.   df           df                       See how much free disk space

   2.   du           du -b subdir             Estimate disk usage of directory in
                                              Bytes

   3.   alias        alias lls="ls -alF"      Create new command "lls" for long
                                              format of ls

   4.   xhost        xhost +                  Permit window to display from x-
                     threat.tjhsst.edu        window program from threat
                     xhost -                  Allow no x-window access from other
                                              systems

   5.   fold         fold -s file1 | lpr      Fold or break long lines at 60
                                              characters and send to printer

   6.   tar          tar -cf subdir.tar       Create an archive called subdir.tar of
                     subdir                   a directory
                     tar -xvf subdir.tar      Extract files from an archive file

   7. ghostview      gv filename.ps           View a Postscript file
   (gv)

   8.   ping         ping threat.tjhsst.edu   See if machine is alive
     (traceroute)    traceroute               Print data path to a machine
                     www.yahoo.com

   9.   top          top                      Print system usage and top resource
                                              hogs

   10. logout        logout or exit           How to quit a UNIX shell.
   (exit)



Some Other Useful Pages
•   Some Useful Files and UNIX Commands: pipe, fork, system(), etc.
•   Getting Started with vi
•   The Basics of HTML
•   Making a Web Page
•   Using LaTeX
•   Generating Graphs with GNU Plot

More Related Content

What's hot (20)

Linux file system
Linux file systemLinux file system
Linux file system
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Unix ppt
Unix pptUnix ppt
Unix ppt
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 
Unix ppt
Unix pptUnix ppt
Unix ppt
 
Linux operating system - Overview
Linux operating system - OverviewLinux operating system - Overview
Linux operating system - Overview
 
Basics of shell programming
Basics of shell programmingBasics of shell programming
Basics of shell programming
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
 
Filepermissions in linux
Filepermissions in linuxFilepermissions in linux
Filepermissions in linux
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
 
Linux User Management
Linux User ManagementLinux User Management
Linux User Management
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsChapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix Concepts
 
Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell ScriptingLinux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
 
Basic command ppt
Basic command pptBasic command ppt
Basic command ppt
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Linux
Linux Linux
Linux
 
User Administration in Linux
User Administration in LinuxUser Administration in Linux
User Administration in Linux
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examples
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 

Viewers also liked

Linux ppt
Linux pptLinux ppt
Linux pptlincy21
 
Node collaboration - sharing information between your systems
Node collaboration - sharing information between your systemsNode collaboration - sharing information between your systems
Node collaboration - sharing information between your systemsm_richardson
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Wave Digitech
 
Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Noé Fernández-Pozo
 
7th sem it_CSVTU
7th sem it_CSVTU7th sem it_CSVTU
7th sem it_CSVTUnksharma128
 
Writing Well-Behaved Unix Utilities
Writing Well-Behaved Unix UtilitiesWriting Well-Behaved Unix Utilities
Writing Well-Behaved Unix UtilitiesRob Miller
 
Internet security protocol
Internet security protocolInternet security protocol
Internet security protocolMousmi Pawar
 
Artificial Intelligence Lab File
Artificial Intelligence Lab FileArtificial Intelligence Lab File
Artificial Intelligence Lab FileKandarp Tiwari
 
Grep - A powerful search utility
Grep - A powerful search utilityGrep - A powerful search utility
Grep - A powerful search utilityNirajan Pant
 
8 Authentication Security Protocols
8 Authentication Security Protocols8 Authentication Security Protocols
8 Authentication Security Protocolsguestfbf635
 
Network security and protocols
Network security and protocolsNetwork security and protocols
Network security and protocolsOnline
 
Regular Expressions grep and egrep
Regular Expressions grep and egrepRegular Expressions grep and egrep
Regular Expressions grep and egrepTri Truong
 
Hill-climbing #2
Hill-climbing #2Hill-climbing #2
Hill-climbing #2Mohamed Gad
 
Linux 101-hacks
Linux 101-hacksLinux 101-hacks
Linux 101-hacksshekarkcb
 
Hillclimbing search algorthim #introduction
Hillclimbing search algorthim #introductionHillclimbing search algorthim #introduction
Hillclimbing search algorthim #introductionMohamed Gad
 
Unix Security
Unix SecurityUnix Security
Unix Securityreplay21
 

Viewers also liked (20)

Basic Unix
Basic UnixBasic Unix
Basic Unix
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Node collaboration - sharing information between your systems
Node collaboration - sharing information between your systemsNode collaboration - sharing information between your systems
Node collaboration - sharing information between your systems
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 
Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014
 
7th sem it_CSVTU
7th sem it_CSVTU7th sem it_CSVTU
7th sem it_CSVTU
 
Writing Well-Behaved Unix Utilities
Writing Well-Behaved Unix UtilitiesWriting Well-Behaved Unix Utilities
Writing Well-Behaved Unix Utilities
 
Grep
GrepGrep
Grep
 
Learning Grep
Learning GrepLearning Grep
Learning Grep
 
Internet security protocol
Internet security protocolInternet security protocol
Internet security protocol
 
Artificial Intelligence Lab File
Artificial Intelligence Lab FileArtificial Intelligence Lab File
Artificial Intelligence Lab File
 
Grep - A powerful search utility
Grep - A powerful search utilityGrep - A powerful search utility
Grep - A powerful search utility
 
8 Authentication Security Protocols
8 Authentication Security Protocols8 Authentication Security Protocols
8 Authentication Security Protocols
 
Network security and protocols
Network security and protocolsNetwork security and protocols
Network security and protocols
 
Unix slideshare
Unix slideshareUnix slideshare
Unix slideshare
 
Regular Expressions grep and egrep
Regular Expressions grep and egrepRegular Expressions grep and egrep
Regular Expressions grep and egrep
 
Hill-climbing #2
Hill-climbing #2Hill-climbing #2
Hill-climbing #2
 
Linux 101-hacks
Linux 101-hacksLinux 101-hacks
Linux 101-hacks
 
Hillclimbing search algorthim #introduction
Hillclimbing search algorthim #introductionHillclimbing search algorthim #introduction
Hillclimbing search algorthim #introduction
 
Unix Security
Unix SecurityUnix Security
Unix Security
 

Similar to Some basic unix commands

Similar to Some basic unix commands (20)

Basic unix commands1
Basic unix commands1Basic unix commands1
Basic unix commands1
 
Introduction to UNIX
Introduction to UNIXIntroduction to UNIX
Introduction to UNIX
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
Linux
LinuxLinux
Linux
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
UNIX.pptx
UNIX.pptxUNIX.pptx
UNIX.pptx
 
Linux basic
Linux basicLinux basic
Linux basic
 
Presentation for RHCE in linux
Presentation  for  RHCE in linux Presentation  for  RHCE in linux
Presentation for RHCE in linux
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 
Basic shell commands by Jeremy Sanders
Basic shell commands by Jeremy SandersBasic shell commands by Jeremy Sanders
Basic shell commands by Jeremy Sanders
 
Lab6FolderF1GraphicPic.pdfPicture of OS Lab.docx
Lab6FolderF1GraphicPic.pdfPicture of OS  Lab.docxLab6FolderF1GraphicPic.pdfPicture of OS  Lab.docx
Lab6FolderF1GraphicPic.pdfPicture of OS Lab.docx
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command Shell
 
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: An Unbeaten Empire
Linux: An Unbeaten EmpireLinux: An Unbeaten Empire
Linux: An Unbeaten Empire
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Operating Systems 2
Operating Systems 2Operating Systems 2
Operating Systems 2
 
Unix environment [autosaved]
Unix environment [autosaved]Unix environment [autosaved]
Unix environment [autosaved]
 

Some basic unix commands

  • 1. Some Basic UNIX Commands by Donald Hyatt The UNIX operating system has for many years formed the backbone of the Internet, especially for large servers and most major university campuses. However, a free version of UNIX called Linux has been making significant gains against Macintosh and the Microsoft Windows 95/98/NT environments, so often associated with personal computers. Developed by a number of volunteers on the Internet such as the Linux group and the GNU project, much of the open-source software is copyrighted, but available for free. This is especially valuable for those in educational environments where budgets are often limited. UNIX commands can often be grouped together to make even more powerful commands with capabilities known as I/O redirection ( < for getting input from a file input and > for outputing to a file ) and piping using | to feed the output of one command as input to the next. Please investigate manuals in the lab for more examples than the few offered here. The following charts offer a summary of some simple UNIX commands. These are certainly not all of the commands available in this robust operating system, but these will help you get started. Ten ESSENTIAL UNIX Commands These are ten commands that you really need to know in order to get started with UNIX. They are probably similar to commands you already know for another operating system. Command Example Description 1. ls ls Lists files in current directory ls -alF List in long format 2. cd cd tempdir Change directory to tempdir cd .. Move back one directory cd ~dhyatt/web-docs Move into dhyatt's web-docs directory 3. mkdir mkdir graphics Make a directory called graphics 4. rmdir rmdir emptydir Remove directory (must be empty)
  • 2. 5. cp cp file1 web-docs Copy file into directory cp file1 file1.bak Make backup of file1 6. rm rm file1.bak Remove or delete file rm *.tmp Remove all file 7. mv mv old.html new.html Move or rename files 8. more more index.html Look at file, one page at a time 9. lpr lpr index.html Send file to printer 10. man man ls Online manual (help) about command Ten VALUABLE UNIX Commands Once you have mastered the basic UNIX commands, these will be quite valuable in managing your own account. Command Example Description 1. grep grep "bad word" * Find which files contain a <str><files> certain word 2. chmod <opt> chmod 644 *.html Change file permissions read <file> chmod 755 file.exe only Change file permissions to executable 3. passwd passwd Change passwd 4. ps <opt> ps aux List all running processes by ps aux | grep dhyatt #ID List process #ID's running by dhyatt 5. kill <opt> <ID> kill -9 8453 Kill process with ID #8453
  • 3. 6. gcc (g++) gcc file.c -o file Compile a program written in <source> g++ fil2.cpp -o fil2 C Compile a program written in C++ 7. gzip <file> gzip bigfile Compress file gunzip bigfile.gz Uncompress file 8. mail mail Send file1 by email to (pine) me@tjhsst.edu < file1 someone pine Read mail using pine 9. telnet <host> telnet vortex.tjhsst.edu Open a connection to vortex ssh <host> ssh -l dhyatt Open a secure connection to jazz.tjhsst.edu jazz as user dhyatt 10. ftp <host> ftp station1.tjhsst.edu Upload or Download files to ncftp ncftp metalab.unc.edu station1 <host/directory> Connect to archives at UNC Ten FUN UNIX Commands These are ten commands that you might find interesting or amusing. They are actually quite helpful at times, and should not be considered idle entertainment. Command Example Description 1. who who Lists who is logged on your machine 2. finger finger Lists who is on computers in the lab 3. ytalk ytalk Talk online with dhyatt who is on threat <user@place> dhyatt@threat 4. history history Lists commands you've done recently 5. fortune fortune Print random humerous message 6. date date Print out current date 7. cal <mo> <yr> cal 9 2000 Print calendar for September 2000
  • 4. 8. xeyes xeyes & Keep track of cursor (in "background") 9. xcalc xcalc & Calculator ("background" process) 10. mpage <opt> mpage -8 file1 Print 8 pages on a single sheet and send <file> | lpr to printer (the font will be small!) Ten HELPFUL UNIX Commands These ten commands are very helpful, especially with graphics and word processing type applications. Command Example Description 1. netscape netscape & Run Netscape browser 2. xv xv & Run graphics file converter 3. xfig / xpaint xfig & (xpaint Run drawing program &) 4. gimp gimp & Run photoshop type program 5. ispell <fname> ispell file1 Spell check file1 6. latex <fname> latex file.tex Run LaTeX, a scientific document tool 7. xemacs / pico xemacs (or pico) Different editors 8. soffice soffice & Run StarOffice, a full word processor 9. m-tools (mdir, mdir a: DOS commands from UNIX (dir mcopy, mcopy file1 a: A:) mdel, mformat, Copy file1 to A: etc. ) 10. gnuplot gnuplot Plot data graphically
  • 5. Ten USEFUL UNIX Commands: These ten commands are useful for monitoring system access, or simplifying your own environment. Command Example Description 1. df df See how much free disk space 2. du du -b subdir Estimate disk usage of directory in Bytes 3. alias alias lls="ls -alF" Create new command "lls" for long format of ls 4. xhost xhost + Permit window to display from x- threat.tjhsst.edu window program from threat xhost - Allow no x-window access from other systems 5. fold fold -s file1 | lpr Fold or break long lines at 60 characters and send to printer 6. tar tar -cf subdir.tar Create an archive called subdir.tar of subdir a directory tar -xvf subdir.tar Extract files from an archive file 7. ghostview gv filename.ps View a Postscript file (gv) 8. ping ping threat.tjhsst.edu See if machine is alive (traceroute) traceroute Print data path to a machine www.yahoo.com 9. top top Print system usage and top resource hogs 10. logout logout or exit How to quit a UNIX shell. (exit) Some Other Useful Pages
  • 6. Some Useful Files and UNIX Commands: pipe, fork, system(), etc. • Getting Started with vi • The Basics of HTML • Making a Web Page • Using LaTeX • Generating Graphs with GNU Plot