Directory operations

The command name Functional description Using an example
mkdir Create a directory mkdir dirname
rmdir Delete a directory rmdir dirname
mvdir Move or rename a directory mvdir dir1 dir2
cd Change the current directory cd dirname
pwd Displays the path name of the current directory pwd
ls Displays the contents of the current directory ls -la
dircmp Compare the contents of the two directories dircmp dir1 dir2

File operations

The command name Functional description Using an example
cat Display or connect files cat filename
pg Page formatting displays file contents pg filename
more Display file content in split screen more filename
od Displays the contents of a non-text file od -c filename
cp Copy files or directories cp file1 file2
rm Delete a file or directory rm filename
mv Change the file name or directory mv file1 file2
ln Join the file ln -s file1 file2
find Use a match expression to find a file find . -name “*.c” -print
file Display file type file filename
open Open the file using the default program open filename

Select operation

The command name Functional description Using an example
head Displays the first few lines of the file head -20 filename
tail Displays the last few lines of the file tail -15 filename
cut Displays certain fields in each line of the file The cut – f1, 7 – d: / etc/passwd
colrm Delete columns from standard input colrm 8 20 file2
paste Horizontal connection file paste file1 file2
diff Compare and display the differences between the two files diff file1 file2
sed Non-interactive stream editor sed “s/red/green/g” filename
grep Look in the file by pattern grep “^[a-zA-Z]” filename
awk Find and process patterns in files awk ‘{print $1 $1}’ filename
sort Sort or merge files sort -d -f -u file1
uniq Remove duplicate lines from the file uniq file1 file2
comm Displays public and non-public lines of two ordered files comm file1 file2
wc Count the number of characters, words, and lines in a file wc filename
nl Number the file in line nl file1 >file2

Safe operation

The command name Functional description Using an example
passwd Changing a User password passwd
chmod Change the permission of a file or directory chmod ug+x filename
umask Define the permission mask to create a file umask 027
chown Change the owner of a file or directory chown newowner filename
chgrp Change the owning group of a file or directory chgrp staff filename
xlock Lock the terminal xlock -remote

Programming operation

The command name Functional description Using an example
make Maintain the latest version of executable programs make
touch Update file access and modification time touch -m 05202400 filename
dbx Command line interface debugging tool dbx a.out
xde Graphical user interface debugging tool xde a.out

Process operation

The command name Functional description Using an example
ps Displays the current process status ps u
kill Terminate the process kill -9 30142
nice Change the priority of the command to be executed nice cc -c *.c
renice Change the priority of a running process renice +20 32768

Time operation

The command name Functional description Using an example
date Displays the current date and time of the system date
cal According to the calendar cal 8 1996
time Count the execution time of the program time a.out

Network and communication operations

The command name Functional description Using an example
telnet Remote login telnet hpc.sp.net.edu.cn
rlogin Remote login rlogin hostname -l username
rsh Executes the specified command on the remote host rsh f01n03 date
ftp Transfer files between local and remote hosts ftp ftp.sp.net.edu.cn
rcp Copies files between local and remote hosts rcp file1 host1:file2
ping Send a response request to a network host ping hpc.sp.net.edu.cn
mail Read and send email mail
write Sends a packet to another user write username pts/1
mesg Allows or denies receiving packets mesg n

Korn Shell command

The command name Functional description Using an example
history List the commands executed recently and their numbers history
r To repeat a command that was executed recently r -2
alias Define an alias for a command alias del=rm -i
unalias Cancels the definition of an alias unalias del

Other commands

The command name Functional description Using an example
uname Displays information about the operating system uname -a
clear Clear screen or window content clear
env Displays all environment variables that are currently set env
who Lists all users currently logged in who
whoami Displays the name of the user currently performing the operation whoami
tty Displays the name of a terminal or pseudo terminal tty
stty Displays or resets control key definitions stty -a
du Example Query the disk usage du -k subdir
df Displays the total and available space of the file system df /tmp
w Displays total information about current system activities w