alias cp="cp -i", set alias name for command
at
- execute job at specific time
-
- at -l or atq: show job queue
- atrm: delete job
- Ctrl-D, stop commands edit
- +2 hours, execute in two hours
- -f file, set file as input
- /etc/at.allow, only users who are listed in this file may execute
- /etc/at.deny, all users may use the at command except those listed in this file
apropos, search command in whatis database
awk, extract content from file
bc, an arbitrary precision calculator language
basename, strip directory and suffix from filenames
batch
- almost same as at command with low priority
- atq, display job queue
- Ctrl+d, stop input
bg, reactive a suspended program in the background
bzip2
- bzip2 -9 -k myfile.doc: compress file
- bzip2 -d myfile.doc.bz2: uncompress file
- -k: keep old file
bunzip2
- uncompress .bz2 file
- -v: show uncompress process
- -k: keep old file
cal
- calender
- -y: year
- -m: month
- cal 07 1999: show calender in July, 1999
cat
- set -o clobber, avoid to overwrite existing file
- cat a.txt: show a.txt
- cat a.txt b.txt > c.txt: combine a.txt and b.txt to form c.txt, delete the previous content in c.txt
- cat a.txt b.txt >> c.txt: attach the content in a.txt and b.txt to c.txt
- cat > a.txt: input content into a.txt from the keyboard
- cat << EOF, instruct the shell to use the text up to the next occurrence of this character sequence as the standard input
cd
- cd /: switch to root
- cd ~: switch to home
- cd ..: switch to upper layer
- cd .: switch to current layer
chattr
- change file or directory attributes
- sudo chattr +i test
- sudo chattr -i test
chfn
chgrp
- change group
- chgrp manager prilist.doc
chmod
- owner, group, other
- a: all; u: owner; g: group; o: other
- x: execute; r: read; w: write
- chmod g+rw mydoc: give reading and writing permission for group
- -R: change permission for all sub directory
chown
- change owner
- chown lisa acclist.doc
chsh
- change user shell
- -l: list shell in the system
clear
cmp, compare two files and return first different character
column, column formatter
colrm 2 4 < filename, removes the second through fourth characters from each line of the text file filename
compress
- compress taipei24.pcf: compress file to .Z file
- -d: uncompress .Z file
- -v: show compress process
comm
- compare two files
- -12: show line in both file
- -23: only show line in first file
cp
- -b: make a backup of each existing destination file
- -r: copy directory
- -R: recursive copy
- -p: keep same access priority
- -i: ask before cover
- -v: show copy process
- -u: only cover older file
- -l: creat link
cpio
- find . | cpio -o -v -O output, pack all file in current directory into output
- cpio -i -v -I output, unpack output file
cron
- Cron Tutorial
- service cron start, start cron
- crontab -u lchen file, execute command for user lchen
- crontab -r, current crontab will be removed
- crontab -l, list user's crontab
- */1****ls>>/tmp/ls.txt
- *(minute) *(hour) *(date) *(month) *(week day)
- /, times per unit
- -, figure value range
- ,, seperate several number
- #, comment
- shopt, permits changing shell options, -s, set, -u, unset
curl, a client to get and send documents
cut
- cut part of the file
- ls -al | cut -b25-, output position 25 and after for each line
- cut -d: -f1,5 /etc/passwd, use : as delimitor and output 1 and 5 fields
- cut -d: -f1-5 /etc/passwd, output 1-5 fields
- cut -d: -f5- /etc/passed, output 5th field and fields after it
- ls -al | cut -d' ' -f1,5, output the first column and fifth column
date
- Tutorial
- date "+%Y:%m:%d: Time:%H:%M:%S"
- date -d "nov 22", display the date of Nov. 22 in this year
- date -d '2 weeks', get the date after two weeks
- date -d 'next monday', get the date of next monday
- date -d 'dec 14 -2 weeks', get the date of two weeks before Dec. 14
- date -d '-100 days', date before 100 days
df
- show hard disk space
- -h: show size by GB
- -T: show file system type
diff
- -b, ignore space change
- -B, ignore blank lines
- -I, ignore case sensitive
- -r, recursive two direcotries
- -y, compare two file by two column
- diff -urN old/ new/ > mysoft.patch
- patch -p0 < mysoft.patch
dir
dirname file, display path name
dircolors, show color set up
du
- -k: count by k
- -m: count by m
- -s: show space occupation in current directory
echo
- echo $PATH: show executable file path
- echo $USER: show current user
- echo $HOME: show home directory
- echo $SHELL: show shell
- echo $BROWSER: show browser environment variable
editres, used for displaying and editing of X resources
env
- set up environment variable
eval, replace, then execute the command replaced
- test.txt, "hello shell world!"
- myfile="cat test.txt"
- echo $myfile #result:cat test.txt
- eval echo $myfile #result:hello shell world!
exec < filename, implement command and return
export PATH, export environment variable
expr
- expression evaluator
- expr 3 + 5, 8
- expr 5 \* 3, 15
- expr substr $string $positon $length, extrace substring of string
- expr length $string, get the length of string
- expr match "$string" '$substring', expr "$string" : '$substring', length of matching substring at beginning of string
- expr index $string $substring, numberical position in $string of first character in $substring that matches
dolphin, file manager
factor, decompose an integer into prime factors
fdisk
fg, put job back to the foreground
file
find
- Example
- find . -name my\*, search by name
- find / -name "my*" -print: serach by name under root directory
- find /usr -atime -3 -print: search files saved within 3 days
- find /usr -ctime -5 -print: search files changed within 5 days
- find /doc -user jacky -print: search by user name
- find ./ -name 'main*' -exec more {} \;: search main* and show it
- find ./ -perm 644, search by permission
- -user, search by user name
- -group, search by group name
- -mtime, search by modify time, -n within n days, +n before n days
- -atime, search by access time, -n wihtin n days, +n before n days
- -ctime, search by create time
- -type, search by type
- -size, search by size
- -newer f1 !f2, search file which is newer than f1 and older than f2
- -ok: same as -exec except has prompt
- -ls: list search results
- -a: and
- -o: or
- !: not
- -xtype, file type
- find ./ -name testFile -exec more {} \;
- find . -name \* -exec echo rm {} \;, display the files that can be deleted
- find . -name \* -exec rm {} \;, delete files
- find . -name \* -ok rm {} \;, prompt before the command is executed
- rm $(find . -name \*), delete files
finger
- show user information
- finger lchen
fmt, simple-minded file formatter
fold, filter that wraps lines of input to a specified width
free, check system memory
ftp
- ls: list directory
- cd: change directory
- lcd: change local directory
- close: close ftp session
- get: get file to local machine
- put: upload file to remote machine
- quit: quit ftp
grep
groupadd
- add group
- groupadd -g 1001 group2, create group group2 and assign GID
groupdel, del group
groupmod -g 10000 -n group3 group2, set GID and change group name to group3
groups
gunzip
- -f: cover same name file
- -r: uncompress the file in the sub directory
- -v: show uncompress process
gzip
- gzip -9 big1.bmp: compress to minimum file
- gzip -1 big1.bmp: compress by fast way
- gzip big1.bmp: default parameter is -6
- -v: show compress process
- -r: compress the files in the directory
- -d: uncompress the file
head
- show first severl lines of file
- head -3 example.c
host
- displays the information on hosts or domains
- host www.google.com
hostname
- show host name
- hostname is saved /etc/hostname
id, show current user id and current group id, groups that current user belongs to
ifconfig
- ifconfig eth0 down, equals to ifdown eth0, inactive ethernet
- ifconfig eth0 up, equals to ifup eth0, active ethernet
- ifconfig eth0, show ip information of eth0
- ifconfig, show all net information
info, equals to man command
infocmp, prints out extensive information about the current terminal
ip, show/manipulate routing, devices, policy routing and tunnels
jobs, show jobs running in the background
join
- join file1 file2, combine two files by same column
kill
- -15: terminal process in an orderly way
- -2: interrupt process, a process can ignore this signal
- -9: force to kill process
- 0: to stop all process except your shell
- -l: list signal which is saved in /usr/include/signal.h
ldconfig, configure share library
ldd
- Check the library that program needs during execution
- ldd /usr/bni/xterm
less, display file
ln
- ln targetfile linkname
- default is hard line which sign several link for one file
- -f: delete previous link before create new link
- -s: symbolic link which like fast link in windows, can link directory
locate
- search library file
- updatedb, update database for locate
login
logout
lpr
ls
- -l, use a long listing format
- -a, do not ignore entries starting with .
- -d, list directory entries instead of contents, and do not dereference symbolic links
- -R, list subdirectories recursively
- --color: color the directory and file if default is no color
- -F: mark executable file and directory
lsattr
- list file and directory attributes
- a, only append allowed
- c, compress file
- d, file is not saved by dump
- i, file is immutable: no deletion, renaming, writing, and linking
- s, secure deletion of file
- S, Synchronous writing of modifications
- u, allow undelete
man
- man date: check the manual of date
- man 1 passwd, show passwd command in section 1
- man 5 passwd, show passwd command in section 5
- man -k passwd, show a list of man pages that have keyword in their one-line synopses
- man -a passwd, show all man pages about passwd one after the other
mandb
- add additional man pages to your system, rebuild this file on Ubuntu, SUSE
- makewhatis, on Red Hat
- catman -w, Solaris, HP-UX, AIX
manpath, default search path for command man
mesg, allow/not allow reveive message from others
mkbootdisk
mkdir
- mkdir -p /company/saledept/jacky: build severl layer directory
- mkdir -m 755 jacky: sign access priority when creat the directory
mke2fs
more, display file
mount
- mount -tsmbfs //userdata.cs.odu.edu/grad/lchen /mnt/Z -o username=lchen,password=PASSWARD,rw,file_mode=0777,dir_mode=0777, mount the network disk
- mount /dev/sdb1 /media/usb: mount usb disk under root
- -t: specify format, ext2, msdos, iso9660, vfat
mtools
- Compitable commands with MS-DOS
mv
- -b, make a backup of each existing destination file
- -i: ask before cover
- -v: show moving process
netstat
- -n: show ip instead of address
- -t: show tcp information
- -u: show udp information
Network
- ./network under /etc/rc.d/init.d
- ./network restart: restart network
newgrp
- switch group when user belongs to several groups
- id, show the user id and current group id, groups that user belongs to
- newgrp test, switch current group to test group
nice
- Nice Tutorial
- -20-19, program priority level
- nice, show default priority level
- need administrator privilege
- nice --1 program, default priority level minus one
- nice -n -13 program, set priority level number
nl, line numbering filter
nohup
- still run the job when user log out
- nohup sort sales.dat &: run sort ignoring user quitting
nslookup
- check ip address
- local: check local ip
- www.google.com: check google server ip
okular
ooffice
- oocalc, excel
- oowriter, word
- oomath, formula edit
- ooweb, dreamweaver
- ooimpress, powerpoint
- oobase, database
- oodraw, painter
ping
- ping www.google.com, check if a host is alive
- -c: set up ping times
- -v: show ping process
passwd
- passwd: change current user password
- passwd tommy: change password for tommy
- -l: lock account
- -u: unlock account
- -d: not password
- -f: force to change password when log in next time
paste
- paste -d -s -file1 file2
- -d, figure delimitor
- -s, cobmine files by merging line instead of combining line by line
patch
- update software
- diff -urn old/ new/ > mysoft.patch
- patch -p0 < mysoft.patch,/li>
printenv, print environment variable value
Printer
- /etc/init.d/cups restart, restart the printer scheduler which is shut down after restart
ps
- -a: list all provesses which is running
- -au: list detail information
- -e: list all processes
- -l: show detailed informaiton
- -x: show executing processs
- ps -ef | grep lchen, show all processes owned by lchen
- ps -auxw | grep bash, show all processes with a process name of bash
pstree, display a tree of processes
pwd, show current path
rclock
rdesktop -g 1024*768 -d 24 vclab.cs.odu.edu, remote desktop control
read
- read -p "Press any key: " name, display prompt
- read -t 1, set up waiting time
- read -n1, read one type and exit
readlink, disclose the file that a symbolic link points to
reboot, reboot computer
rename
- rename multiple files
- rename 's/\.bak$//' *.bak
- renmae 'y/A-Z/a-z/' *
renice
- Renice Tutorial
- renice -5 -p 5200, change running program priority level to -5
- -g, reset priority level for all programs of the group
- -p, reset priority level for program
- -u, reset priority level for all programs of the user
reset, reset terminal parameters and clear text screen
resize, echoes commands necessary to set $TERM and $TERMCAP to duplicate the size (dimensions) of the current terminal
rm
- -i: ask before delete
- -v: show deleting process
- -r: delete directory
- -f: delete without asking
rmdir
route, show internet route
rpm
- -i: install
- -test: test install
- -replacepkgs: force to install the software which has been installed
- -ignoreos: ignore safty checking
- -v: show extra information
- -vv: show debug information
- -root DIRECTORY: figure out install directory
- -e: delete software package
- -U: update the software
screen
- -r, resume screen when remote connection is abnormal broken
script, records (saves to a file) all the user keystrokes at the command-line in a console or an xterm window, exit to stop
sed, stream editor
seq
- seq 10, output 1 to 10
- seq 2 7, output 2 to 7
- seq 1 2 20, output 1 to 20 with step 2
service
- service --status-all, list all service
- service program restart, start a service
shopt, permits changing shell options, -s, set, -u, unset
sleep, pause and run the command later
- (sleep 1800; echo "Lunch time ...") &
sort
- sort and output
- -d, ignore specific character, such as %
- -f, ignore capital or lower case characters
- -u, ignore repeat line
- -n, sort by value
- -t, figure out delimiter
- -r, reverse sort
- sort -nk 5, sort file by the fifth column
- sort +1 -2 -n file, sort second column by real value instead of the number at first position
shutdown
- shutdown -h now: shut down right now
- shutdown -h +30: shut down in 30 minutes
- shutdown -h 12:10: shut down at 12:10
- shutdown -c: cancel the sutdown command
- shutdown -r now: reboot computer
- shutdown -k +10 'content': sent out a shut down warning, not real shut down
stat, similar to ls, list file size, access, Uid, Gid, access time
ss, show net information
ssh
- ssh lchen@hpcq.cs.odu.edu, log in hpcq
- ssh lchen@hpcq.cs.odu.edu ls, implement ls on hpcq
strings, filter character strings out of binary files
- -n, return strings which are at lease the numer of that interger in length
- -t, return the offset position for each line on which one or more strings are found
su
sudo
- make user has permission to perform root command
- -l: check what kind of command can be executed by current user
- -h: show sudo parameter
- -s: figure out shell
- -k: enforce to ake password when implement next sudo command
tail
- show several tail line of file
- tail -20f example.c
tar
- tar -cf new1.tar my1*.doc: pack the files but no compress
- tar -zcf new1.tar.gz my1*.doc: pack and compress the file by gzip
- tar -Zcf new1.tar.Z my1*.doc: pack and compress the file by Compress
- tar -zxvf onepackage.tgz: uncompress the files from package
- -r: add file to the packed file
- -r: update file in the packed file
- -c, creat
- -x, unpack a file
- -t, check tar file
- -z, compress by gzip
- -Z, compress by Compress
- -j, check bzip2 character
- -v, show document when exectue packing
- -f, fellow the document name
- -p, use previous character
- -P, sign the path
- tar -cvf file.tar ./file
- tar -zcvf file.tar.gz ./file
- tar -jcvf file.tar.bz2 ./file
tee
- read data from standard input and output into file
- -a, append to file
- date | tee file1 file2
telinit
- change system running level
- who -r, check running level
- 0, halt
- 1, single user mode
- 2, multiuser, without NFS
- 3, full multiuser mode
- 4, unused
- 5, X11
- 6, reboot
test, check file types and compare values
time
- time, show program running time
- /usr/bin/time, show the exit status of the command and the elapsed time
top
- show top process running
- -i: do not show spare process
- -r: adjust process priority level
- -u: show processes of the specific user
touch, create a file
tr
- tr Tutorial
- transform characters
- -c, complement the set of characters in string
- -d, delete character
- -s, delete repeat character
- tr -cs "[:alpha:]" "\n" < /path/to/file, creater a list of the words in /path/to/file, one per line
- \\, "\"
- \a, alarm
- \b, backspace
- \f, change page
- \n, new line
- \r, enter
- \t, tab
- \v, vertical table character
- [a-z], [A-Z], [0-9]
- [:alnum:], all alphabets and all numbers
- [:alpha:], all alphabets
- [:blank:], all blank space
- [:cntrl:], all control characters
- [:digit:], all numbers
- [:graph:], all printable characters except blank
- [:lower:], all lower case characters
- [:print:], all printable characters
- [:punct:], all delimiter characters
- [:space:], all space
- [:upper:], all capital letters
- tr "h2" "3x" < sname, change "h" to "3", "2" to "x"
- cat file | tr "abc" "xyz" > new_file, replace "abc" with "xyz"
- grep \* output.txt | tr '[:lower:]' '[:upper:]'
- cat testFile | tr [a-z] [A-Z]
- cat file | tr [A-Z] [a-z]
- cat file | tr -d "Snail" > new_file, delete "Snail" in the strings
- cat file | tr -d "\n\t" > new_file, delete \n and \t
- cat file | tr -s [a-zA-Z] > new_file, delete repeat characters
- cat file | tr -s "\n" > new_file, delete empty lines
- grep \* output.txt | tr -d '\n', delete all enter characters and print out
tracepath, trace the path to specific address
tree, display the tree structure of a folder
type, show the type of the command
ulimit -a, show file size limit
umask, sets the file mode creation mask
- set up default permission for new file and new directory
- default value is 022
- directory, 777-022
- file, 666-022
- umask, show umask value, 0022
- umask 002, remove write for others, value is changed to 0002
umount
- umount /media/usb: remove usb disk under root
uname
- -a: show system information
uncompress
uniq
- uniq [option] [input] [output], remove the continuous repeat lines
- -c: show the number of occurrences
- -d: only print duplicate lines
- -u: only show the line without repeat
unzip
- unzip onepackage.zip a*.doc: uncompress part of files
- -f: uncompress updated files
- -u: uncompress updated files and none-exist files
- -o: uncompress and cover previous files
- -n: uncompress none-exist files
- -j: all uncompress under current directory, not mater where the files are
- -d: uncompress under specfic directory
uptime, check how long the system has been running
userdrake
- add, delete user and set up group
userinfo
usermod
- -s, change shell
- useradd -s /bin/sh sam, change shell to sh for sam
- -d, change home directory
- -g, change group
usermount
userpasswd
- change password for current user
users
useradd
- -m: create directory
- -g: alocate group
- -s: figure out shell
- -u: figure out user number
- adduser -d /usr/sam -m sam: create account for sam
- adduser -s /bin/sh -g group -G adm,root gem: create account for gem
userdel, delete user account
usleep, pauses #N microseconds
updatedb, update database for locate
uptime, show system load average, average processes number in the queue
vdir
vmstate, check memory
w, check who is logged in the system
wall, send message to all users who are connected to this machine
wc
- wc names, get a count of the total number of lines, words, and characters of information contained in a file
- -c: count character number
- -l: count line
- -L: count length of maxmium line
whatis, serach system command database
whereis
- whereis bzip2: show command directory and the directory for the man page
which, show command place
who
- show current user information
- -b: show last log in time
- -a: show all information
- -r: show running level
whoami
whois, specific domain information
write
- send message to other persons
- who, check who is connecting to this machine
- write lchen, start write and send message to lchen
xargs, create command line
- find /etc -type f -print | xargs grep LUENE02
xdpyinfo, information about the X server
xev, displays the X events
xine
xhost
- xhost, display the machines that are allowed to access current machine
- xhost +, allow all machines access current machine
- xhost + hpcq.cs.odu.edu, add machine to allowed list
- xhost - hpcq.cs.odu.edu, remove machine from allowed list
xkill
- xkill -id 0*340000b, kill creator of resource 0*340000b
xlsclients
- list the display clients and program
- xlsclients -l -a, list all information
xmag, magnify parts of the screen
xman, display of man pages
xmodmap, used to change the keyboard mapping
xmore, more with graphic interface
xprop, display information about clients
xrandr, check monitor resolution
xset, set up keyboard click, sound, or the screen saver
xwd, save the current screen contents in a file
xwininfo
- display window information
- -geometry 81*24+0+0, window of 81 char by 24 line lines in the upper left corner of the screen
zdump
- zdump EST, echoes the time in a specified time zone
zip
- zip new1.zip my1*.doc: compress and pack files
- zip -d new1.zip my18.doc: delete file from compress file
- zip -g new1.zip my32.doc: add file into compress file
- zip -u new1.zip my2*.doc: update file in the compress file
- -r: compress directory
Device
- Touchpad
- in /ect/X11/xorg.conf
- Section "InputDevice"
- Identifier "Synaptics Touchpad"
- Driver "synaptics"
- Option "SendCoreEvents" "true"
- Option "Device" "/dev/psaus"
- Option "Protocol" "auto-dev"
- Option "HorizEdgeScroll" "0"
- Option "SHMConfig" "0"
- EndSection
- synclient touchpadoff=1, turn off touchpad
- synclient touchpadoff=0, turn on touchpad