Announcements 
Meeting Notes 
Membership 
News 
Sponsors 
Linux Links 
 

introduction 
bash 
commands 
filesystems 
software installation 
resources 
 




Linux/Unix Commands
 

File Commands  

chown change file owner and group
chgrp change group ownership
chmod change file access permissions
rm remove files or directories
rmdir remove empty directories
mv move (rename) files
find search for files in a directory hierarchy
cd Change working directory
mkdir make directories


Text Processing/Parsing Commands  

cat concatenate files and print on the standard output
more file perusal filter for crt viewing
less opposite of more
head output the first part of files
tail output the last part of files
sort sort lines of text files
cut remove sections from each line of files
uniq remove duplicate lines from a sorted file
grep, egrep, fgrep print lines matching a pattern
sed a Stream EDitor
awk pattern scanning and processing language
tr translate or delete characters
vi screen-oriented (visual) display editor
wc print the number of bytes, words, and lines in files


Archive Commands  

tar The GNU version of the tar archiving utility
cpio copy files to and from archives
gzip, gunzip, zcat compress or expand files
bzip2, bunzip2 a block-sorting file compressor, v0.9.5
rpm Red Hat Package Manager


Network Commands  

ping send ICMP ECHO_REQUEST packets to network hosts
traceroute print the route packets take to network host
nslookup query Internet name servers interactively
netstat Display network connections, routing tables, interface statistics, masquerade connections, netlink messages, and multicast memberships


Programming Commands  

gcc, g++ GNU project C and C++ Compiler (egcs-1.1.2)
perl Practical Extraction and Report Language
make GNU make utility to maintain groups of programs
rcs change RCS file attributes


Binary Commands  

file determine file type
strip Discard symbols from object files.
strings print the strings of printable characters in files
od dump files in octal and other formats
strace trace system calls and signals


Examples  

Remove a file with a leading '-' character
[user@host user]$ rm -- -file

Remove the '\r' (carriage return) from DOS files
[user@host user]$ cat file | tr -d '\015' > file.$$ && mv -i file.$$ file

How to find 'text' in a group of files
[user@host user]$ find . -exec grep text {} \; -print 2>/dev/null

Find files with an executable bit set
[user@host user]$ find . -perm +111 ! -type d -print 2>/dev/null

Find files modified in the last two minutes on a single filesystem
[user@host user]$ find . -xdev -mmin -2 -print

Compute the amount of disk space used and order from greatest to least
[user@host user]$ du -sk * | sort -rn

Search for lines beginning with 'open' and containing either bash, login or profile
[user@host user]$ cat file | grep ^open | egrep '(bash|login|profile)'

Determine how many unique shells are used in /etc/passwd file
[user@host user]$ cat /etc/passwd | cut -d: -f 7 | sort | uniq
[user@host user]$ cat /etc/passwd | awk -F: '{print $7}' | sort | uniq

Create an archive
[user@host user]$ tar cf directory.tar directory | gzip -9 > directory.tar.gz
[user@host user]$ tar czf directory.tar.gz directory 

List an archive's table of contents
[user@host user]$ gzip -dc directory.tar.gz | tar tf -
[user@host user]$ tar tzf directory.tar.gz

Extract an archive
[user@host user]$ gzip -dc directory.tar.gz | tar xvf -
[user@host user]$ tar xzvf directory.tar.gz

Move a directory from one filesystem to another
[user@host user]$ tar cf - directory | ( cd /filesystem2 ; tar xvpf - )

List the kernel routing table
[user@host user]$ netstat -rn

Determine somefile's file type
[user@host user]$ file somefile

Trace program's system calls and signals capturing all output in program.out
[user@host user]$ strace program &> program.out

Get the ASCII character or backslash escape characters of file
[user@host user]$ od -t c file

Hard reset the terminal (for when you accidentally cat a binary file)
[user@host user]$ echo ^O # type Ctl-v Ctl-o

Last updated