Вы находитесь на странице: 1из 8

UNIX Commands

Heading
df

find

Objective
df command displays
information about total space
and available space on a file
system
This displays the file system
statistics in 1024-byte disk
blocks.
This displays file system
statistics in MB disk blocks
rounded off to nearest 2nd
decimal digit.
This displays file system
statistics in GB disk blocks
rounded off to nearest 2nd
decimal digit.
Finds files with a matching
expression.
This searches the entire file
system and writes the
complete path names of all
files named .profile. The /
(slash) tells the find command
to search the root directory and
all of its subdirectories.
This lists the names of the files
that have only owner-read and
owner-write permission. The .
(dot) tells the find command to
search the current directory
and its subdirectories.
To list all files in the current
directory that have been
changed during the current 24hour period.
To lists the names of the
ordinary files (-type f) that
have more than one link (links +1).
To find all accessible files
whose path name contains find
To search for all files that are
exactly 414 bytes long

Command

Example

df k

df -k /test

df m

df -m /test

df g

df -g /test

find /

find / -name .profile


-print

find .

find . -perm 0600


print

find . ctime

find . -ctime 1
print

find . -type f

find . -type f -links


+1 print

find . name

find . -name '*find*'


print
find . -size 414c
print

find . -size

Wait

date

errpt

fmt

Waits until the termination of a


process ID.
Waits until the termination of a
process123456789.
Displays the date in the
desired format.
Displays the date in the format
equivalent to %m/%d/%y.
Displays the locale's full
month name.
Displays the hour (24-hour
clock) as a decimal number
(00-23).
Displays the locale's
equivalent of either AM or
PM.
Displays 12-hour clock time
(01-12) using the AM-PM
notation; in the POSIX
locale, this is equivalent to %I:
%M:%S %p.
Generates a report of logged
errors.
To display a complete
summary report
To display a complete detailed
report
To display a detailed report of
all errors logged for the error
identifier E19E094F
To display a detailed report of
all errors logged in the past 24
hours.
To list error-record templates
for which logging is turned off
for any error-log entries.
To view all entries from the
alternate error-log file
/var/adm/ras/errlog.alternate
To display a detailed report of
all errors and group duplicate
errors
Formats mail messages prior
to sending.
To format a message you have
created with the mail editor

wait [ ProcessID]

wait 123456789

date +"%D"
date +"%B"
date +"%H"
date +"%p"
date +"%r"

errpt
errpt -a
errpt -a
errpt -a -s mmddhhmmyy
errpt -t -F log=0
errpt -i
/var/adm/ras/errlog.alternate
errpt aD

~| fmt

errpt -a -j
E19E094F

fuser

ipcs
jobs

ls

The file file1 is formatted and


displayed on your screen
Identifies processes using a
file or file structure.
To list the process numbers of
local processes using the
/etc/passwd file
To list the process numbers
and user login names of
processes using the
/etc/filesystems file
To terminate all of the
processes using a given file
system
To list all processes that are
using a file which has been
deleted from a given file
system.
Reports interprocess
communication facility status.
Displays status of jobs in the
current session.
To display the status of jobs in
the current environment
To display the process ID for
the job whose name begins
with "m"
Displays the contents of a
directory.
To list all files in the current
directory
To display a long listing with
detailed information about
chap1 and .profile.
To display a long listing for
the directories . and manual,
and for the file manual/chap1.
(Without the -d flag, this
would list the files in the . and
manual directories instead of
the detailed information about
the directories themselves.)
To display a long listing of the
files that were modified most
recently, followed by the older
files.

fmt filename

fmt file1

fuser /etc/passwd
fuser -u /etc/filesystems

fuser -k -x -u -c
/dev/hd1 or
fuser -kxuc /home
fuser -d /usr

Ipcs

jobs l
job -p %m

ls a
ls -l chap1 .profile
ls -d -l . manual
manual/chap1

ls -l t

mail,
Mail, or
mailx

netstat

ps

Sends and receives mail.


The mail command lists every
messages in your system
mailbox.
To send the message letter to
the recipient user1@host1 and
copies to
user2@host2 and user3@host3
To display a list of the
messages in your personal
mailbox

Mail

To send a message to a user on


your local system
Shows network status.
To display routing table
information for an Internet
interface
To display interface
information for an Internet
interface
To display statistics for each
protocol
To display device driver
statistics
To display information
regarding an interface for
which multicast is enabled,
and to see group membership
To display the packet counts in
the communication subsystem
Shows current status of
processes
To display all processes
To list processes owned by
specific users
To list processes that are
associated with the
/dev/console and /dev/tty1
ttys
To list processes not associated
with a terminal
To display a specified format

mail ron

mail -c "user2@host2
user3@host3"
user1@host1<letter
mail f

mail -f +dept
This displays a
listing of the msgs
in the dept folder.

netstat -r -f inet
netstat -i -f inet
netstat -s -f inet
netstat v
netstat -a -I interface

netstat D

ps -e f
ps -f -l -ujim,jane,su
ps -t console,tty/1

ps -t ps -o

rlogin

shutdown

su

uname

rsh or
remsh

with field specifiers


To display information about
processes and kernel threads
controlled by the current
terminal
To display information about
all processes and kernel
threads
Connects a local host with a
remote host.
To log in to a remote host with
your local user name
To log in to a remote host with
a different user name
To log in to a remote host with
your local user name and
change the escape character
Ends system operation.
To turn off the machine
To give users more time to
finish what they are doing and
bring the system to
maintenance mode
Changes the user ID
associated with a session.
To obtain root user authority
To obtain the privileges of the
jim user
To set up the environment as if
you had logged in as the jim
user
To run the backup command
with root user authority and
then return to your original
shell
Displays the name of the
current operating system.
To display the complete
system name and version
banner
Executes the specified
command at the remote host or
logs into the remote host.
To check the amount of free
disk space on a remote host

ruser,pid,ppid=parent,args
ps lm

ps -emo THREAD

rlogin host2
rlogin host2 -l dale
rlogin host2 -e\

Shutdown
shutdown -m +2

Su
su jim
su jim
su root "-c
/usr/sbin/backup -9
-u"

uname a

rsh host2 df

grep

To append a remote file to


another file on the remote
host, place the >>
metacharacters in quotation
marks
To append a remote file at the
remote host to a local file,
omit the quotation marks
To append a remote file to a
local file and use a remote
user's permissions at the
remote host (The remote file
test4 is appended to the local
file test5 at the remote host,
with user jane's permissions.)
Searches a file for a pattern.
To use a pattern that contains
some of the pattern-matching
characters *,
^, ?, [, ], \(, \), \{, and \}
To display all lines that do not
match a pattern
To display all lines in the file1
file that match either the abc
or xyz string
To search for a $ (dollar sign)
in the file named test2

rsh host2 cat test1


">>" test2

rsh host2 cat test2


>> test3
rsh host2 -l jane cat
test4 >> test5

grep "^[a-zA-Z]"
pgm.s
grep v

grep -v "^#" pgm.s

grep E

grep -E "abc|xyz"
file1
grep \\$ test2

Thisoption causes a caseinsensitive search.


The noption lists the matching
lines, together with line numbers.

grep i

This option matches only whole


words.

grep w

The loption lists only the files


in which matches were found, but
not the matching lines.

grep l

The r(recursive) option


searches files in the current
working directory and all
subdirectories below
it.

grep r

The noption lists the matching


lines, together with line numbers.

grep n

vi (visual) vi is a display-oriented text


editor based on an underlying
line editor. When using vi,
changes we make to the file
are reflected in what we see on
our screen.
By using this we come out of
text mode and enter into
command mode.

vi options filename

ESC

1. Commands for Saving


Work / Editing
write file under original name

:w

write file under original name,


exit vi
exit vi, no changes are saved

ZZ or :wq

write the file under filename

:w filename

write the file under filename,


overwrite existing file
write lines x through y under
filename
filename write lines x through
y under filename , overwrite
existing filename

:w! filename

:q!

:x,y w filename
:x,y w!

2. Commands for Inserting


Text
insert before the current
character
insert after the current
character
insert at end of current line
insert at beginning of current
line
insert below current line
(opens new line)
insert above current line
(opens new line)

i
a
A
I
o
O

end text insertion

ESC

3. Commands for Replacing


Text
replace the current character
replace the current word
replace the current line

r
s
S

4. Commands for Deleting Text


delete the current character
delete the current line
delete the previous character

x
dd
X

5. Commands for Copying


(yank) and Pasting Text
yank current character
yank current word
yank current line
place most recently deleted or
yanked character(s) or word(s)
after the current character,
place line(s) below current line
place most recently deleted or
yanked character(s) or word(s)
before the current character,
place line(s) above the current
line

y
yw
yy
p

Вам также может понравиться