SlideShare a Scribd company logo
1 of 4
Download to read offline
4/3/2019 Basic Shell Commands
https://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/commands_basic/ 1/4
Basic Shell Commands
Jeremy Sanders
October 2011
1. acroread - Read or print a PDF file.
2. cat - Send a file to the screen in one go. Useful for piping to other programs
cat file1 # list file1 to screen
cat file1 file2 file3 > outfile # add files together into outfile
cat *.txt > outfile # add all .txt files together
cat file1 file2 | grep fred # pipe files
3. cc - Compile a C program
cc test1.c # compile test1.c to a.out
cc -O2 -o test2.prog test2.c # compile test2.c to test2.prog
4. cd - Change current directory
cd # go to home directory
cd ~/papers # go to /home/user/papers
cd ~fred # go to /home/fred
cd dir # go to directory (relative)
cd /dir1/dir2/dir3... # go to directory (absolute)
cd - # go to last directory you were in
5. cp - Copy file(s)
cp file1 file2 # copy file1 to file2
cp file1 directory # copy file1 into directory
cp file1 file2 file3 ... directory # copy files into directory
cp -R dir1 dir2/ # copy dir1 into dir2 including subdirectries
cp -pR dir1 dir2/ # copy directory, preserving permissions
6. date - Shows current date
> date
Sat Aug 31 17:18:53 BST 2002
7. dvips - Convert a dvi file to PostScript
dvips document.dvi # convert document.dvi to document.ps
dvips -Ppdf document.dvi # convert to ps, for conversion to pdf
8. emacs - The ubiquitous text editor
emacs foo.txt # open file in emacs
emacsclient foo.txt # open file in existing emacs (need to use
# M-x start server first)
9. file - Tells you what sort of file it is
> file temp_70.jpg
temp_70.jpg: JPEG image data, JFIF standard 1.01,
resolution (DPI), 72 x 72
10. firefox - Start Mozilla Firefox
11. f77/f90 - Compile a Fortran 77/99 program
f77 -O2 -o testprog testprog.f
12. gedit - Gnome text editor
13. gnuplot - A plotting package.
14. grep - Look for text in files. List out lines containing text (with filename if more than one file
examined).
4/3/2019 Basic Shell Commands
https://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/commands_basic/ 2/4
grep "hi there" file1 file2 ... # look for 'hi there' in files
grep -i "hi there" filename # ignore capitals in search
cat filename | grep "hi there" # use pipe
grep -v "foo" filename # list lines that do not include foo
15. gtar - GNU version of the tar utility (also called tar on Linux). Store directories and files together
into a single archive file. Use the normal tar program to backup files to a tape. See info tar for
documentation.
gtar cf out.tar dir1 # put contents of directory into out.tar
gtar czf out.tar.gz dir1 # write compressed tar, out.tar.gz
gtar tf in.tar # list contents of in.tar
gtar tzf in.tar.gz # list contents of compressed in.tar.gz
gtar xf in.tar # extract contents of in.tar here
gtar xzf in.tar.gz # extract compressed in.tar.gz
gtar xf in.tar file.txt ... # extract file.txt from in.tar
16. gv - View a Postscript document with Ghostscript.
17. gzip / gunzip - GNU Compress files into a smaller space, or decompress .Z or .gz files.
gzip file.fits # compresses file.fits into file.fits.gz
gunzip file.fits.gz # recovers original file.fits
gzip *.dat # compresses all .dat files into .dat.gz
gunzip *.dat.gz # decompresses all .dat.gz files into .dat
program | gzip > out.gz # compresses program output into out.gz
program | gunzip > out # decompresses compressed program output
18. info - A documentation system designed to replace man for GNU programs (e.g. gtar, gcc). Use
cursor keys and return to go to sections. Press b to go back to previous section. A little hard to use.
info gtar # documentation for gtar
19. kill - Kill, pause or continue a process. Can also be used for killing daemons.
> ps -u jss
...
666 pts/1 06:06:06 badprocess
> kill 666 # this sends a ``nice'' kill to the
# process. If that doesn't work do
> kill -KILL 666 # (or equivalently)
> kill -9 666 # which should really kill it!
> kill -STOP 667 # pause (stop) process
> kill -CONT 667 # unpause process
20. latex - Convert a tex file to dvi
21. logout - Closes the current shell. Also try ``exit''.
22. lp - Sends files to a printer
lp file.ps # sends postscript file to the default printer
lp -dlp2 file.ps # sends file to the printer lp2
lp -c file.ps # copies file first, so you can delete it
lpstat -p lp2 # get status and list of jobs on lp2
cancel lp2-258 # cancel print job lp2-258
lpr -Plp2 file.ps # send file.ps to lp2
lpq -Plp2 # get list of jobs on lp2
lprm -Plp2 1234 # delete job 1234 on lp2
23. ls - Show lists of files or information on the files
ls file # does the file exist?
ls -l file # show information about the file
ls *.txt # show all files ending in .txt
ls -lt # show information about all files in date order
ls -lrt # above reversed in order
ls -a # show all files including hidden files
ls dir # show contents of directory
ls -d dir # does the directory exist?
ls -p # adds meaning characters to ends of filenames
4/3/2019 Basic Shell Commands
https://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/commands_basic/ 3/4
ls -R # show files also in subdirectories of directory
ls -1 # show one file per line
24. man - Get instructions for a particular Unix command or a bit of Unix. Use space to get next page
and q to exit.
man man # get help on man
man grep # get help on grep
man -s1 sort # show documentation on sort in section 1
25. more - Show a file one screen at a time
more file # show file one screen at a time
grep 'frog' file | more # Do it to output of other command
26. mv - Move file(s) or rename a file
mv file1 file2 # rename file1 to file2
mv dir1 dir2 # rename directory dir1 to dir2
mv file1 file2 file3 ... directory # move files into directory
27. nano - very simple text editor. Warning - this program can introduce extra line breaks in your file if
the screen is too narrow!
28. nice - Start a process in a nice way. Nice levels run from -19 (high priority) to 19 (low priority).
Jobs with a higher priority get more CPU time. See renice for more detail. You should probably be
using the grid-engine to run long jobs.
nice +19 myjob1 # run at lowest priority
nice +8 myjob2 # run at lowish priority
29. openoffice.org - a free office suite available for Linux/Unix, Windows and Mac OS X.
30. passwd - change your password
31. pine - A commonly used text-based mail client. It is now called alpine. Allows you to send and
receive emails. Configuration options allow it to become quite powerful. Other alternatives for mail
are mozilla mail and mutt, however I suggest you stick to alpine or thunderbird.
32. printenv - Print an environment variable in tcsh
setenv MYVARIABLE Fred
printenv MYVARIABLE
printenv # print all variables
33. ps - List processes on system
> ps -u jss # list jss's processes
934 pts/0 00:00:00 bash
^^^^^ ^^^^^ ^^^^^^^^ ^^^^^^^
PID output CPU time name
> ps -f # list processes started here in full format
> ps -AF # list all processes in extra full format
> ps -A -l # list all processes in long format
> ps -A | grep tcsh # list all tcsh processes
34. pwd - Show current working directory
> pwd
/home/jss/writing/lecture
35. quota - Shows you how much disk space you have left
> quota -v
...
36. renice - Renice a running process. Make a process interact better with other processes on the
system (see top to see how it is doing). Nice levels run from -19 (high priority) to 19 (low priority).
Only your own processes can be niced and they can only be niced in the positive direction (unless
you are root). Normal processes start at nice 0.
4/3/2019 Basic Shell Commands
https://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/commands_basic/ 4/4
> ps -u jss | grep bigprocess # look for bigprocess
1234 pts/0 99:00:00 bigprocess
> renice 19 1234 # renice PID 1234 to 19
37. rm - Delete (remove) files
rm file1 # delete a file (use -i to ask whether sure)
rm -r dir1 # delete a directory and everything in it (CARE!)
rm -rf dir1 # like above, but don't ask if we have a -i alias
38. rmdir - Delete a directory if it is empty (rm -r dirname is useful if it is not empty)
rmdir dirname
39. staroffice - An office suite providing word processor, spreadsheet, drawing package. See Users'
Guide on how to install this. This is a commercial version of the openoffice office package - use
openoffice.org on linux.
40. setenv - Set an environment variable in tcsh.
setenv MYVARIABLE Fred
echo Hi there $MYVARIABLE
41. tar - Combine files into one larger archive file, or extract files from that archive (same as gtar on
Linux).
tar cvf /dev/rmt/0 ./ # backup cwd into tape
tar tvf /dev/rmt/0 # list contents of tape
tar xvf /dev/rmt/0 # extract contents of tape
42. thunderbird - Start mozilla thunderbird.
43. top - Interactively show you the ``top'' processes on a system - the ones consuming the most
computing (CPU) time. Press the ``q'' key in top to exit. Press the ``k'' key to kill a particular
process. Press ``r'' to renice a process.
About this document ...
Basic Shell Commands
This document was generated using the LaTeX2HTML translator Version 2008 (1.71)
Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of
Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -split 0 -font_size 10pt -no_navigation commands_basic.tex
The translation was initiated by Jeremy Sanders on 2011-10-02
Jeremy Sanders 2011-10-02

More Related Content

What's hot

101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystemsAcácio Oliveira
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unixsouthees
 
The Linux Command Cheat Sheet
The Linux Command Cheat SheetThe Linux Command Cheat Sheet
The Linux Command Cheat SheetTola LENG
 
101 4.2 maintain the integrity of filesystems
101 4.2 maintain the integrity of filesystems101 4.2 maintain the integrity of filesystems
101 4.2 maintain the integrity of filesystemsAcácio Oliveira
 
Archiving in linux tar
Archiving in linux tarArchiving in linux tar
Archiving in linux tarInfoExcavator
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common CommandJeff Yang
 
Linux Security Quick Reference Guide
Linux Security Quick Reference GuideLinux Security Quick Reference Guide
Linux Security Quick Reference Guidewensheng wei
 
Unix reference sheet
Unix reference sheetUnix reference sheet
Unix reference sheetapajadeh
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filtersAcácio Oliveira
 
101 3.5 create, monitor and kill processes
101 3.5 create, monitor and kill processes101 3.5 create, monitor and kill processes
101 3.5 create, monitor and kill processesAcácio Oliveira
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filtersAcácio Oliveira
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filtersAcácio Oliveira
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to LinuxDimas Prasetyo
 
3.2 process text streams using filters
3.2 process text streams using filters3.2 process text streams using filters
3.2 process text streams using filtersAcácio Oliveira
 
SGN Introduction to UNIX Command-line 2015 part 2
SGN Introduction to UNIX Command-line 2015 part 2SGN Introduction to UNIX Command-line 2015 part 2
SGN Introduction to UNIX Command-line 2015 part 2solgenomics
 

What's hot (20)

50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
50 Most Frequently Used UNIX Linux Commands -hmftj
50 Most Frequently Used UNIX  Linux Commands -hmftj50 Most Frequently Used UNIX  Linux Commands -hmftj
50 Most Frequently Used UNIX Linux Commands -hmftj
 
Examples -partII
Examples -partIIExamples -partII
Examples -partII
 
101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 
The Linux Command Cheat Sheet
The Linux Command Cheat SheetThe Linux Command Cheat Sheet
The Linux Command Cheat Sheet
 
101 4.2 maintain the integrity of filesystems
101 4.2 maintain the integrity of filesystems101 4.2 maintain the integrity of filesystems
101 4.2 maintain the integrity of filesystems
 
Archiving in linux tar
Archiving in linux tarArchiving in linux tar
Archiving in linux tar
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common Command
 
Linux Security Quick Reference Guide
Linux Security Quick Reference GuideLinux Security Quick Reference Guide
Linux Security Quick Reference Guide
 
Unix reference sheet
Unix reference sheetUnix reference sheet
Unix reference sheet
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
 
Know the UNIX Commands
Know the UNIX CommandsKnow the UNIX Commands
Know the UNIX Commands
 
Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
 
101 3.5 create, monitor and kill processes
101 3.5 create, monitor and kill processes101 3.5 create, monitor and kill processes
101 3.5 create, monitor and kill processes
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
 
101 3.2 process text streams using filters
101 3.2 process text streams using filters101 3.2 process text streams using filters
101 3.2 process text streams using filters
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
 
3.2 process text streams using filters
3.2 process text streams using filters3.2 process text streams using filters
3.2 process text streams using filters
 
SGN Introduction to UNIX Command-line 2015 part 2
SGN Introduction to UNIX Command-line 2015 part 2SGN Introduction to UNIX Command-line 2015 part 2
SGN Introduction to UNIX Command-line 2015 part 2
 

Similar to Basic shell commands by Jeremy Sanders

Similar to Basic shell commands by Jeremy Sanders (20)

Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
14.Linux Command
14.Linux Command14.Linux Command
14.Linux Command
 
3.1.a linux commands reference
3.1.a linux commands reference3.1.a linux commands reference
3.1.a linux commands reference
 
bash_1_2021-command line introduction.pdf
bash_1_2021-command line introduction.pdfbash_1_2021-command line introduction.pdf
bash_1_2021-command line introduction.pdf
 
Linux
LinuxLinux
Linux
 
Linux
Linux Linux
Linux
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Rhel 6.2 complete ebook
Rhel 6.2  complete ebookRhel 6.2  complete ebook
Rhel 6.2 complete ebook
 
Lamp ppt
Lamp pptLamp ppt
Lamp ppt
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Rhel 6.2 complete ebook
Rhel 6.2 complete ebookRhel 6.2 complete ebook
Rhel 6.2 complete ebook
 
Linux
LinuxLinux
Linux
 
Basic Linux day 1
Basic Linux day 1Basic Linux day 1
Basic Linux day 1
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
Linux cheat sheet
Linux cheat sheetLinux cheat sheet
Linux cheat sheet
 
Some basic unix commands
Some basic unix commandsSome basic unix commands
Some basic unix commands
 

Recently uploaded

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 

Recently uploaded (20)

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 

Basic shell commands by Jeremy Sanders

  • 1. 4/3/2019 Basic Shell Commands https://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/commands_basic/ 1/4 Basic Shell Commands Jeremy Sanders October 2011 1. acroread - Read or print a PDF file. 2. cat - Send a file to the screen in one go. Useful for piping to other programs cat file1 # list file1 to screen cat file1 file2 file3 > outfile # add files together into outfile cat *.txt > outfile # add all .txt files together cat file1 file2 | grep fred # pipe files 3. cc - Compile a C program cc test1.c # compile test1.c to a.out cc -O2 -o test2.prog test2.c # compile test2.c to test2.prog 4. cd - Change current directory cd # go to home directory cd ~/papers # go to /home/user/papers cd ~fred # go to /home/fred cd dir # go to directory (relative) cd /dir1/dir2/dir3... # go to directory (absolute) cd - # go to last directory you were in 5. cp - Copy file(s) cp file1 file2 # copy file1 to file2 cp file1 directory # copy file1 into directory cp file1 file2 file3 ... directory # copy files into directory cp -R dir1 dir2/ # copy dir1 into dir2 including subdirectries cp -pR dir1 dir2/ # copy directory, preserving permissions 6. date - Shows current date > date Sat Aug 31 17:18:53 BST 2002 7. dvips - Convert a dvi file to PostScript dvips document.dvi # convert document.dvi to document.ps dvips -Ppdf document.dvi # convert to ps, for conversion to pdf 8. emacs - The ubiquitous text editor emacs foo.txt # open file in emacs emacsclient foo.txt # open file in existing emacs (need to use # M-x start server first) 9. file - Tells you what sort of file it is > file temp_70.jpg temp_70.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), 72 x 72 10. firefox - Start Mozilla Firefox 11. f77/f90 - Compile a Fortran 77/99 program f77 -O2 -o testprog testprog.f 12. gedit - Gnome text editor 13. gnuplot - A plotting package. 14. grep - Look for text in files. List out lines containing text (with filename if more than one file examined).
  • 2. 4/3/2019 Basic Shell Commands https://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/commands_basic/ 2/4 grep "hi there" file1 file2 ... # look for 'hi there' in files grep -i "hi there" filename # ignore capitals in search cat filename | grep "hi there" # use pipe grep -v "foo" filename # list lines that do not include foo 15. gtar - GNU version of the tar utility (also called tar on Linux). Store directories and files together into a single archive file. Use the normal tar program to backup files to a tape. See info tar for documentation. gtar cf out.tar dir1 # put contents of directory into out.tar gtar czf out.tar.gz dir1 # write compressed tar, out.tar.gz gtar tf in.tar # list contents of in.tar gtar tzf in.tar.gz # list contents of compressed in.tar.gz gtar xf in.tar # extract contents of in.tar here gtar xzf in.tar.gz # extract compressed in.tar.gz gtar xf in.tar file.txt ... # extract file.txt from in.tar 16. gv - View a Postscript document with Ghostscript. 17. gzip / gunzip - GNU Compress files into a smaller space, or decompress .Z or .gz files. gzip file.fits # compresses file.fits into file.fits.gz gunzip file.fits.gz # recovers original file.fits gzip *.dat # compresses all .dat files into .dat.gz gunzip *.dat.gz # decompresses all .dat.gz files into .dat program | gzip > out.gz # compresses program output into out.gz program | gunzip > out # decompresses compressed program output 18. info - A documentation system designed to replace man for GNU programs (e.g. gtar, gcc). Use cursor keys and return to go to sections. Press b to go back to previous section. A little hard to use. info gtar # documentation for gtar 19. kill - Kill, pause or continue a process. Can also be used for killing daemons. > ps -u jss ... 666 pts/1 06:06:06 badprocess > kill 666 # this sends a ``nice'' kill to the # process. If that doesn't work do > kill -KILL 666 # (or equivalently) > kill -9 666 # which should really kill it! > kill -STOP 667 # pause (stop) process > kill -CONT 667 # unpause process 20. latex - Convert a tex file to dvi 21. logout - Closes the current shell. Also try ``exit''. 22. lp - Sends files to a printer lp file.ps # sends postscript file to the default printer lp -dlp2 file.ps # sends file to the printer lp2 lp -c file.ps # copies file first, so you can delete it lpstat -p lp2 # get status and list of jobs on lp2 cancel lp2-258 # cancel print job lp2-258 lpr -Plp2 file.ps # send file.ps to lp2 lpq -Plp2 # get list of jobs on lp2 lprm -Plp2 1234 # delete job 1234 on lp2 23. ls - Show lists of files or information on the files ls file # does the file exist? ls -l file # show information about the file ls *.txt # show all files ending in .txt ls -lt # show information about all files in date order ls -lrt # above reversed in order ls -a # show all files including hidden files ls dir # show contents of directory ls -d dir # does the directory exist? ls -p # adds meaning characters to ends of filenames
  • 3. 4/3/2019 Basic Shell Commands https://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/commands_basic/ 3/4 ls -R # show files also in subdirectories of directory ls -1 # show one file per line 24. man - Get instructions for a particular Unix command or a bit of Unix. Use space to get next page and q to exit. man man # get help on man man grep # get help on grep man -s1 sort # show documentation on sort in section 1 25. more - Show a file one screen at a time more file # show file one screen at a time grep 'frog' file | more # Do it to output of other command 26. mv - Move file(s) or rename a file mv file1 file2 # rename file1 to file2 mv dir1 dir2 # rename directory dir1 to dir2 mv file1 file2 file3 ... directory # move files into directory 27. nano - very simple text editor. Warning - this program can introduce extra line breaks in your file if the screen is too narrow! 28. nice - Start a process in a nice way. Nice levels run from -19 (high priority) to 19 (low priority). Jobs with a higher priority get more CPU time. See renice for more detail. You should probably be using the grid-engine to run long jobs. nice +19 myjob1 # run at lowest priority nice +8 myjob2 # run at lowish priority 29. openoffice.org - a free office suite available for Linux/Unix, Windows and Mac OS X. 30. passwd - change your password 31. pine - A commonly used text-based mail client. It is now called alpine. Allows you to send and receive emails. Configuration options allow it to become quite powerful. Other alternatives for mail are mozilla mail and mutt, however I suggest you stick to alpine or thunderbird. 32. printenv - Print an environment variable in tcsh setenv MYVARIABLE Fred printenv MYVARIABLE printenv # print all variables 33. ps - List processes on system > ps -u jss # list jss's processes 934 pts/0 00:00:00 bash ^^^^^ ^^^^^ ^^^^^^^^ ^^^^^^^ PID output CPU time name > ps -f # list processes started here in full format > ps -AF # list all processes in extra full format > ps -A -l # list all processes in long format > ps -A | grep tcsh # list all tcsh processes 34. pwd - Show current working directory > pwd /home/jss/writing/lecture 35. quota - Shows you how much disk space you have left > quota -v ... 36. renice - Renice a running process. Make a process interact better with other processes on the system (see top to see how it is doing). Nice levels run from -19 (high priority) to 19 (low priority). Only your own processes can be niced and they can only be niced in the positive direction (unless you are root). Normal processes start at nice 0.
  • 4. 4/3/2019 Basic Shell Commands https://www-xray.ast.cam.ac.uk/~jss/lecture/computing/notes/out/commands_basic/ 4/4 > ps -u jss | grep bigprocess # look for bigprocess 1234 pts/0 99:00:00 bigprocess > renice 19 1234 # renice PID 1234 to 19 37. rm - Delete (remove) files rm file1 # delete a file (use -i to ask whether sure) rm -r dir1 # delete a directory and everything in it (CARE!) rm -rf dir1 # like above, but don't ask if we have a -i alias 38. rmdir - Delete a directory if it is empty (rm -r dirname is useful if it is not empty) rmdir dirname 39. staroffice - An office suite providing word processor, spreadsheet, drawing package. See Users' Guide on how to install this. This is a commercial version of the openoffice office package - use openoffice.org on linux. 40. setenv - Set an environment variable in tcsh. setenv MYVARIABLE Fred echo Hi there $MYVARIABLE 41. tar - Combine files into one larger archive file, or extract files from that archive (same as gtar on Linux). tar cvf /dev/rmt/0 ./ # backup cwd into tape tar tvf /dev/rmt/0 # list contents of tape tar xvf /dev/rmt/0 # extract contents of tape 42. thunderbird - Start mozilla thunderbird. 43. top - Interactively show you the ``top'' processes on a system - the ones consuming the most computing (CPU) time. Press the ``q'' key in top to exit. Press the ``k'' key to kill a particular process. Press ``r'' to renice a process. About this document ... Basic Shell Commands This document was generated using the LaTeX2HTML translator Version 2008 (1.71) Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds. Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney. The command line arguments were: latex2html -split 0 -font_size 10pt -no_navigation commands_basic.tex The translation was initiated by Jeremy Sanders on 2011-10-02 Jeremy Sanders 2011-10-02