SlideShare a Scribd company logo
1 of 2
Download to read offline
UNIX C Shell Cheat Sheet
Setup
File Manipulation
Terminal Setup % stty erase โ€˜^?โ€™ kill โ€˜^Uโ€™ intr โ€˜^Cโ€™
% set term=vt100
Setting Path Variable % set path=(directory ... directory)
Password Changing % passwd
Changing Default
Shell
% chsh
Help % man command
% man -k topic
Logging Out % logout
% <CTRL-D>
Listing Files % ls
Displaying Files % cat filename
% more filename
<space> next page
<return> next line
q quit
Copying Files % cp file1 file2
% cp file1 [file2] ... directory
% cp -r directory1 directory2
Use the -i option to prompt before overwriting files.
Moving Files % mv file1 file2
% mv file1 [file2] ... directory
% mv directory1 directory2
Use the -i option to prompt before overwriting files.
Removing Files % rm filename
% rm -r directory
Use the -i option to prompt before deleting files.
Printing Files % lpr filename
Directory Manipulation
Miscellaneous Commands
File Protection
Creating Directories % mkdir directory
Changing Directories % cd directory
% cd
Displaying Current
Directory
% pwd
Removing Directories % rmdir directory
Finding Files % find directory -name filename -print
Searching Files % grep string filename
Sorting Files % sort [-o output-file] filename
Comparing Files % diff filename1 filename2
% cmp filename1 filename2
User and Permission
Types
u file owner (u is short for user)
g group members
o all other users
r read permission
w write permission
x execute permission (for directories, allows users to use
the directory name in a pathname)
Displaying File
Protection
% ls -l filename
Changing File
Protection
% chmod [ugo][+-=][rwx] filename
% chmod nnn filename
numeric protection mode table
user group other
r 400 40 4
w 200 20 2
x 100 10 1
Default Protection % umask nnn
The umask value is subtracted from 666 for new files and
from 777 for new directories.
I/O Redirection
C Shell Specific Commands
Input Redirection % command < filename
Output Redirection
(overwrite)
% command > filename
Output Redirection
(append)
% command >> filename
Error Redirection
(overwrite)
% command >& filename
Error Redirection
(append)
% command >>& filename
Noclobber Variable % set noclobber
Setting the noclobber variable protects files from being
accidentally overwritten due to output redirection (but not
cp, mv, etc.). โ€œ!โ€ following any redirection operator over-
rides noclobber.
Piping Operator % command1 | command2
Enable Tracking of
Commands
% set history=n
Displaying Com-
mand History
% history
Re-executing Previ-
ous Commands
!! previous command
!n nth command
!string last command beginning with string
!-n nth most recent command
!?string? last command containing string
Saving Command
History
% set savehist=n
Setting Aliases % alias alias-string command-string
Displaying Aliases % alias
Deleting Aliases % unalias alias-string
Special Files
Job Control
.cshrc This file, if it exists in your home directory, is automatically
executed at login. Must begin with โ€œ#โ€ to indicate C shell
script.
.cshrc typically includes C shell specific commands such
as the set noclobber, set history, set savehist,
and alias commands.
.login This file, if it exists in your home directory, is automatically
executed at login. Must begin with โ€œ#โ€ to indicate C shell
script.
.login typically contains generic UNIX commands such
as the stty, set path, and umask commands.
.logout This file, if it exists in your home directory, is automatically
executed at logout. Must begin with โ€œ#โ€ to indicate C shell
script.
.logout typically contains commands to perform cleanup.
Running Jobs in the
Background
% command &
Stopping Foreground
Jobs
% command
.
.
.
<CTRL-Z>
%
Job Status % jobs
Killing Jobs % kill %job-number
% kill process-id
Bringing Jobs to the
Foreground
% fg %job-number
Moving Jobs to the
Background
% bg %job-number
Process Status % ps lists all your processes
% ps -a lists all running processes
% ps -x full listing for given option
Displaying Users % who
% whoami

More Related Content

Similar to csh_cheatsheet.pdf

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
ย 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
southees
ย 
List command linux a z
List command linux a zList command linux a z
List command linux a z
Jinyuan Loh
ย 
List command linux fidora
List command linux fidoraList command linux fidora
List command linux fidora
Jinyuan Loh
ย 
Commands
CommandsCommands
Commands
damlepramod
ย 
archive A-Z linux
archive A-Z linuxarchive A-Z linux
archive A-Z linux
elahe salimi
ย 
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 csh_cheatsheet.pdf (20)

Unix commands
Unix commandsUnix commands
Unix commands
ย 
Basic basic solaris quick referent card
Basic basic solaris quick referent cardBasic basic solaris quick referent card
Basic basic solaris quick referent card
ย 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
ย 
Bootcamp linux commands
Bootcamp linux commandsBootcamp linux commands
Bootcamp linux commands
ย 
List command linux a z
List command linux a zList command linux a z
List command linux a z
ย 
Terminal linux commands_ Fedora based
Terminal  linux commands_ Fedora basedTerminal  linux commands_ Fedora based
Terminal linux commands_ Fedora based
ย 
List command linux fidora
List command linux fidoraList command linux fidora
List command linux fidora
ย 
apache-refcard-a4.pdf
apache-refcard-a4.pdfapache-refcard-a4.pdf
apache-refcard-a4.pdf
ย 
Linux Command Line - By Ranjan Raja
Linux Command Line - By Ranjan Raja Linux Command Line - By Ranjan Raja
Linux Command Line - By Ranjan Raja
ย 
Commands
CommandsCommands
Commands
ย 
archive A-Z linux
archive A-Z linuxarchive A-Z linux
archive A-Z linux
ย 
Comenzi unix
Comenzi unixComenzi unix
Comenzi unix
ย 
Group13
Group13Group13
Group13
ย 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell Scripting
ย 
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
ย 
Bash cheat sheet
Bash cheat sheetBash cheat sheet
Bash cheat sheet
ย 
Bash cheat sheet
Bash cheat sheetBash cheat sheet
Bash cheat sheet
ย 
Linux
LinuxLinux
Linux
ย 
Course 102: Lecture 8: Composite Commands
Course 102: Lecture 8: Composite Commands Course 102: Lecture 8: Composite Commands
Course 102: Lecture 8: Composite Commands
ย 
Basic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manualBasic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manual
ย 

Recently uploaded

๐Ÿ“ฑDehradun Call Girls Service ๐Ÿ“ฑโ˜Ž๏ธ +91'905,3900,678 โ˜Ž๏ธ๐Ÿ“ฑ Call Girls In Dehradun ๐Ÿ“ฑ
๐Ÿ“ฑDehradun Call Girls Service ๐Ÿ“ฑโ˜Ž๏ธ +91'905,3900,678 โ˜Ž๏ธ๐Ÿ“ฑ Call Girls In Dehradun ๐Ÿ“ฑ๐Ÿ“ฑDehradun Call Girls Service ๐Ÿ“ฑโ˜Ž๏ธ +91'905,3900,678 โ˜Ž๏ธ๐Ÿ“ฑ Call Girls In Dehradun ๐Ÿ“ฑ
๐Ÿ“ฑDehradun Call Girls Service ๐Ÿ“ฑโ˜Ž๏ธ +91'905,3900,678 โ˜Ž๏ธ๐Ÿ“ฑ Call Girls In Dehradun ๐Ÿ“ฑ
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
ย 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
SUHANI PANDEY
ย 
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRLLucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
imonikaupta
ย 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
ย 
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐ŸฅตLow Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Chandigarh Call girls 9053900678 Call girls in Chandigarh
ย 
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹
nirzagarg
ย 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
SUHANI PANDEY
ย 

Recently uploaded (20)

(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
ย 
Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
ย 
๐Ÿ“ฑDehradun Call Girls Service ๐Ÿ“ฑโ˜Ž๏ธ +91'905,3900,678 โ˜Ž๏ธ๐Ÿ“ฑ Call Girls In Dehradun ๐Ÿ“ฑ
๐Ÿ“ฑDehradun Call Girls Service ๐Ÿ“ฑโ˜Ž๏ธ +91'905,3900,678 โ˜Ž๏ธ๐Ÿ“ฑ Call Girls In Dehradun ๐Ÿ“ฑ๐Ÿ“ฑDehradun Call Girls Service ๐Ÿ“ฑโ˜Ž๏ธ +91'905,3900,678 โ˜Ž๏ธ๐Ÿ“ฑ Call Girls In Dehradun ๐Ÿ“ฑ
๐Ÿ“ฑDehradun Call Girls Service ๐Ÿ“ฑโ˜Ž๏ธ +91'905,3900,678 โ˜Ž๏ธ๐Ÿ“ฑ Call Girls In Dehradun ๐Ÿ“ฑ
ย 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
ย 
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRLLucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
ย 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
ย 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
ย 
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...
ย 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
ย 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
ย 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
ย 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
ย 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
ย 
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort Service
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort ServiceBusty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort Service
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort Service
ย 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
ย 
All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445
All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445
All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445
ย 
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐ŸฅตLow Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
ย 
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹
ย 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
ย 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
ย 

csh_cheatsheet.pdf

  • 1. UNIX C Shell Cheat Sheet Setup File Manipulation Terminal Setup % stty erase โ€˜^?โ€™ kill โ€˜^Uโ€™ intr โ€˜^Cโ€™ % set term=vt100 Setting Path Variable % set path=(directory ... directory) Password Changing % passwd Changing Default Shell % chsh Help % man command % man -k topic Logging Out % logout % <CTRL-D> Listing Files % ls Displaying Files % cat filename % more filename <space> next page <return> next line q quit Copying Files % cp file1 file2 % cp file1 [file2] ... directory % cp -r directory1 directory2 Use the -i option to prompt before overwriting files. Moving Files % mv file1 file2 % mv file1 [file2] ... directory % mv directory1 directory2 Use the -i option to prompt before overwriting files. Removing Files % rm filename % rm -r directory Use the -i option to prompt before deleting files. Printing Files % lpr filename Directory Manipulation Miscellaneous Commands File Protection Creating Directories % mkdir directory Changing Directories % cd directory % cd Displaying Current Directory % pwd Removing Directories % rmdir directory Finding Files % find directory -name filename -print Searching Files % grep string filename Sorting Files % sort [-o output-file] filename Comparing Files % diff filename1 filename2 % cmp filename1 filename2 User and Permission Types u file owner (u is short for user) g group members o all other users r read permission w write permission x execute permission (for directories, allows users to use the directory name in a pathname) Displaying File Protection % ls -l filename Changing File Protection % chmod [ugo][+-=][rwx] filename % chmod nnn filename numeric protection mode table user group other r 400 40 4 w 200 20 2 x 100 10 1 Default Protection % umask nnn The umask value is subtracted from 666 for new files and from 777 for new directories.
  • 2. I/O Redirection C Shell Specific Commands Input Redirection % command < filename Output Redirection (overwrite) % command > filename Output Redirection (append) % command >> filename Error Redirection (overwrite) % command >& filename Error Redirection (append) % command >>& filename Noclobber Variable % set noclobber Setting the noclobber variable protects files from being accidentally overwritten due to output redirection (but not cp, mv, etc.). โ€œ!โ€ following any redirection operator over- rides noclobber. Piping Operator % command1 | command2 Enable Tracking of Commands % set history=n Displaying Com- mand History % history Re-executing Previ- ous Commands !! previous command !n nth command !string last command beginning with string !-n nth most recent command !?string? last command containing string Saving Command History % set savehist=n Setting Aliases % alias alias-string command-string Displaying Aliases % alias Deleting Aliases % unalias alias-string Special Files Job Control .cshrc This file, if it exists in your home directory, is automatically executed at login. Must begin with โ€œ#โ€ to indicate C shell script. .cshrc typically includes C shell specific commands such as the set noclobber, set history, set savehist, and alias commands. .login This file, if it exists in your home directory, is automatically executed at login. Must begin with โ€œ#โ€ to indicate C shell script. .login typically contains generic UNIX commands such as the stty, set path, and umask commands. .logout This file, if it exists in your home directory, is automatically executed at logout. Must begin with โ€œ#โ€ to indicate C shell script. .logout typically contains commands to perform cleanup. Running Jobs in the Background % command & Stopping Foreground Jobs % command . . . <CTRL-Z> % Job Status % jobs Killing Jobs % kill %job-number % kill process-id Bringing Jobs to the Foreground % fg %job-number Moving Jobs to the Background % bg %job-number Process Status % ps lists all your processes % ps -a lists all running processes % ps -x full listing for given option Displaying Users % who % whoami