Command | Description | Commonly Used Options/Notes | Example |
---|---|---|---|
alias [command1] [command2] | csh/tcsh : replaces a command with the alias | ||
alias [command1]=["command2"] | ksh/bash : replaces a command with the alias | alias dc='echo "You mean cd ?"' | |
basename [string] [suffix] | Where [string] is the full path- and filename of a file basename writes out the filename only. If [suffix] is provided and the extension matches [suffix] this is also removed | ||
cat [file] | Display contents of [file] | ||
cat [file1] [file2] > [file3] | Concatenates [file1] and [file2] into [file3] | ||
cd [directory] | Change directory to [directory] | 'cd' on its own changes to the user's home directory | |
chgrp [group] [file] | Change group ownership of a file | ||
chmod [mode] [file] | Change file permissions; mode can be either absolute or symbolic. (Using digits: owner, group, others. 4-read,2-write,1-execute.) | chmod 770 afile.txt : make afile.txt accessible and executable to the owner and everyone in the owner's group | |
chown [owner][:group] [file] | Change file ownership | ||
cmp [file1] [file2] | Compare [file1] and [file2] | ||
compress [file/file pattern] | Compress [file/file pattern] | See also "uncompress" | |
cp [file1] [file2] | Copies [file1] to [file2] | Use './' as the second argument to copy the file to the current directory | |
cut -d [delimiter] -f [field numbers] [filename] | Separates fields [filed numbers] out of file [filename] using [delimiter] to determine start and end of fields | cut -d : -f 1,5 /etc/passwd | |
date | Show date and time | ||
df [file system] | Show available space on file system [file system] | 'df -k ./' - show available space in kilobytes of current file system | |
diff [file1] [file2] | List the differences between [file1] and [file2] | ||
dirname [string] | Where [string] is the full path- and filename of a file dirname writes out the path only | ||
du | Display directory space usage | 'du -akd /test | sort -nr' - sort directory /test on largest to smallest | |
echo [variable] | Show value of variable [variable] | echo $MAIL | |
env | Show current environment variables | ||
exit | End session | ||
export [variable]=[value] | Set environment variable [variable] to value [value] - ksh/bash (see also "setenv") | ||
file | Display file type | ||
find | Find file(s). | -name [pattern]; -size [size] | find ./ -size +100000c : find all files greater than 100000 bytes find ./ -name *.dmp : find all files ending in "dmp" find ./ -name *.dmp -exec ls -lrt {} \; -print : show file sizes (pass to ls) find /adir -newer afile.txt 2>/dev/null -exec ls -ltr {} \; : find all files in directories adir and below which are newer than file afile.txt and list the contents of the directories |
finger [username] | Show details of [username] | ||
grep [options] "word" [files] | Search files for pattern "word" | -c Show only count of matched lines -h show matched lines, not filenames -i ignore case -l show filenames not lines -n Show lines and line nos -s suppress error messages -v Show lines which don't match "word" -w Match whole word (not all unix) | grep -c "fish" *.txt |
head [-number] [file] | Display first [-number] of lines of a file (default 10 ) | ||
head [file] | Show first lines of a file; default is ten | -n [number] : number of lines to display | head -n 2 afile.txt |
history [-number] | Show recent commands | ||
ln [source file] [target file] | Create hard or symbolic link to a file | -s : create symbolic link | |
ls [options] | List files/directories | -a all entries -d list directory name only (not contents) -l show all details -p include slash after directory names -r reverse list order -s show size in blocks -t sort by timestamp -u sort by last access timestamp (when using -t or -l) -1 one entry per line -R Recursively lists subdirectories encountered. -h Display size in K/Mb/Gb etc | ls -ltr [show files in reverse data order] ls ./ -R | grep wallet [list files in directoryu and subdirectories containing "wallet" |
man [command] | Display manual information on command [command] | The manual pages must have been installed on the machine | |
man [command] | Show manual pages available for [command] | ||
mkdir [directory] | Make directory [directory] | ||
more [file] | Display contents of file screen by screen | ||
more | [file_1] [file_2] [file_n] | Display contents of files | -c clear screen between pages rather than scrolling |
mv [file1] [file2] | Renames ('mv' = 'move') [file1] to [file2], including location | mv afile.txt afile.old | |
passwd | Change passwd | ||
printf [format] [argument] | Outputs [argument] to standard output according to the specified [format]. [argument] can include escape sequences such as \n etc. | ||
ps | List processes | Show top 15 processes (in terms of resources): Solaris: /usr/ucb/ps -aux | head -15 AIX: ps aux | head -15 List in full all processes containing the word "pmon" : ps -ef | grep pmon | |
psrinfo -v | Show processor information | ||
pwd | Show current directory ("print working directory") | ||
rm [file/file pattern] | Deletes ('rm'='remove') [file/file pattern] | 'rm stats.dat' - delete file stats.dat 'rm *.txt' - delete all files with .txt extension | |
rmdir [directory] | Delete ('remove') directory [directory] | ||
script [-a][file] | Logs a record of all output to screen in [file]. If [-a] is supplied the file will be appended to. Turn script off by pressing Ctl-D | ||
setenv [variable] [value] | Set environment variable [variable] to value [value] - csh/tcsh (see also "export") | ||
sort [file] | Sorts [file] alphabetically | ||
split [-l] [value] [file] | Splits file [file] into new files, each having [value] lines | ||
tail [+/- value] [file] | Displays the end of a file; if [+/- value] is not given defaults to 10 | tail -5 afile.txt | |
tee file1 [filen] | Sends standard output to files as well as screen | who | tee who1.txt who2.txt | |
touch [file] | Sets access and modification of [file]. Creates [file] if it does not exist | ||
unalias [command] | Removes an alias (see "alias") | ||
uname [options] | Show system details | -a basic details -i platform -n node name -p processor type -r OS level -s OS name -v OS version | uname -a |
uncompress [file/file pattern] | Uncompress [file/file pattern] | See also "compress" | |
unset [variable] | Removes the variable from the variable list | ||
uptime | Time the system has been up, number of users logged in, system load average | ||
w [options][user] | System usage summary | -h suppress headings, uptime info -l long format -s short format | w -l fred |
wc [file] | Summary of line, word and character count in [file] | Show the version: wc --version Help: wc --help Line count of test.ksh: wc -l test.ksh Longest line in test.ksh: wc -L test.ksh Word count for test.ksh: wc -w test.ksh Number of characters in test.ksh: wc -m test.ksh Number of bytes in test.ksh: wc -c test.ksh | |
whatis [command] | Display brief summary of [command] | ||
whereis [command] | locate the binary, source, and or manual page files for [command] | ||
which [command] | Display the file that would be executed when running [command] | ||
who | Show users logged in | ||
whoami | Show name of user logged in | May need to be entered as 'who am i' |