0% found this document useful (0 votes)
26 views

UNIX Linux Commands

Unix Linux Commands

Uploaded by

Luis Jácome
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

UNIX Linux Commands

Unix Linux Commands

Uploaded by

Luis Jácome
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

AU2768_book.

fm Page 217 Tuesday, November 16, 2004 2:17 PM

Appendix D

UNIX/Linux Commands
UNIX will be used to mean both UNIX and Linux, since they are very
similar. In essence, Linux is another flavor of UNIX, similar to Solaris,
AIX, and others. A great benefit of Linux is that it is open-source (the
source code is open for all to see). A UNIX system command reference
will be provided since it has been widely used for decades and its
use is increasing globally.
When working on a UNIX system, you could encounter either a
GUI interface (pictures/icons/words to point and click on) or a command line (various UNIX commands must be typed to work with the
system not a point-and-click operation). Working at the command
line will be presented since the GUI is much easier to use and more
intuitive. Many skilled UNIX personnel do not have a GUI interface
on their machine because they much prefer to type commands at the
command line (more powerful and versatile and more difficult).
At the command line, there are various prompts that you could
encounter, depending on how the owner has configured the system.
The prompts you see are indicative of the type of shell (environment)
the system owner is using. The shell allows the user to use a few
commands/configurations that are peculiar to that shell. Although there
are others, the most common prompts/shells you will come across are:
Korn Shell Prompt
Bourne Shell Prompt
C Shell Prompt

Copyright 2005 CRC Press LLC

$
$
%

AU2768_book.fm Page 218 Tuesday, November 16, 2004 2:17 PM

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Although there are many UNIX commands, I will cover those that are
most useful to an investigator and make extensive use of examples to
show how a command is most commonly used.
FTP commands:
? command
close, disconnect, bye, quit
UNIX commands such as cd, ls, etc.
delete filename
get file1 [file2]
help
help command
lcd /usr/cell_one/log (changes to local machine directory)
mdelete filename(s).
mget filename(S)
mkdir directory
mput filename(s)
put file1 [file2]
pwd
rmdir directory
rcv file1 [file2] (retrieve from remote).
remotehelp command
rename file1 file2
send file1 [file2]

Copyright 2005 CRC Press LLC

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

date
sort infile
who
who am I
clear
echo whatever
I type
banner big
words
cat file1 file2
file3
df system

head file

tail file

Explanation

Example

End Result

Writes the current date to the screen


Sorts the contents of the input file in
alphabetical order
Tells who is logged onto your server
Tells you your user information
Clears the window and the line buffer
Writes whatever I type to the screen

date
sort names

Mon Nov 20 18:25:37 EST 2000


Sorts the contents of names in
alphabetical order

Does the same thing as echo only in


BIG words
Shows the three files in consecutive
order as one document (can be used
to combine files)
Reports the number of free disk blocks

Prints the first 10 lines of the file to the


screen
Number of lines can be modified
Prints the last 10 lines of the file to the
screen
Number of lines can be modified

Copyright 2005 CRC Press LLC

who
who am i
clear
echo hey you!
banner hey!
cat cheese milk

df ~
df $HOME

head addresses
head -25
addresses
tail test.txt
tail -32 test.txt

Writes hey you! to the screen


Writes hey! in large letters on the
screen
Prints the cheese file to the screen first
and immediately follows it with the
milk file
Both commands will print the total kb
space, kb used, kb available, and
%used on the home system (your
system)
Prints the first 10 lines of addresses to
the screen
Prints the first 25 lines of addresses to
the screen
Prints the last 10 lines of test.txt to the
screen
Prints the last 32 lines of test.txt to the
screen

AU2768_book.fm Page 219 Tuesday, November 16, 2004 2:17 PM

UNIX
Command

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

more input

ls (-optionoptional)

Explanation

Example

End Result

Prints to screen whatever is input


useful because it only shows one
screen at a time
scroll bar continues to the next screen
return moves one line forward
Q quits
G goes to the end
1G goes to the beginning
Ctrl u moves up _ screen
Ctrl d moves down _ screen
Lists all the nonhidden files and
directories

more groceries

Will list the groceries file to the screen

ls

Lists all nonhidden files and directories


in the current directory
Lists all nonhidden files and directories
in the
bin directory
Lists all nonhidden files and directories
in the current directory in
long format
Lists all nonhidden files and directories
in the work directory in long format
Lists all files and directories, including
hidden, in the current directory
Lists all files and directories in the
temp directory

ls bin

ls -l or ll

ls -a

Lists all nonhidden files and directories


in long format

Lists all files and directories including


hidden ones

ls -l
ll
ls -l work
ll work
ls -a
ls -a temp

Copyright 2005 CRC Press LLC

AU2768_book.fm Page 220 Tuesday, November 16, 2004 2:17 PM

UNIX
Command

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Lists all files and directories in reverse


alphabetical order

ls -r

ls -r abc

ls -t

Lists all nonhidden files in the order


they were last modified

ls -t

ls -t work

Note: Options can be combined using ls.


|
>
>>
&

pipe directs the output of the first


command to the input of another
Sends the output of a command to a
designated file
Appends the output of a command to
a designated file
Runs command in the background; you
can still work in the window

Copyright 2005 CRC Press LLC

ls -al
ls -l | more
ls -l > myfiles
ls -l >> allfiles
xclock &

Lists all nonhidden files and directories


in the current directory in reverse
alphabetical order
Lists all nonhidden files and directories
in the abc directory in reverse
alphabetical order
Lists all the nonhidden files in the
current directory in the order they
were last modified from most recent
to last
Lists all the nonhidden files in the work
directory in the order they were last
modified from most recent to last
Lists all files (including hidden (-a)) in
long format (-l)
Lists your files in long format one
screen at a time
Prints your listing to a file named
myfiles
Appends your filenames to the end of
the allfiles file
Runs xclock (a clock) allowing you to
keep working

AU2768_book.fm Page 221 Tuesday, November 16, 2004 2:17 PM

ls -r

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Explanation

Example

End Result

Designates the home directory


($HOME)
Designates input from somewhere
other than terminal

echo ~

Writes your home directory to the


screen
progA program gets its input from a file
named input1

Wildcards

Explanation

Example

End Result

Any string of characters

ls * .c

Any one character

ls file?

[]

Match any character in the brackets


(a hyphen is used for ranges of
characters)

ls v[6-9]file

Lists any file or directory (nonhidden)


ending with c
Lists any file/directory with file and 1
character at the end
Lists v6file, v7file, v8file, and v9file

Explanation

Example

End Result

Changes your current directory to the


directory specified

cd bin

Changes directory to the bin directory

cd ..
cd ../..

Moves you to the directory that contains


the directory you are currently in
Ex. Current directory=/home/users/
bob/bin execute cd ..
New directory= /home/users/bob
or executing cd ../..
New directory= /home/users.

~
<

UNIX
Command

cd directory

Copyright 2005 CRC Press LLC

progA < input1

AU2768_book.fm Page 222 Tuesday, November 16, 2004 2:17 PM

Important
Characters

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

cd ~
cd
mkdir dirname

rm file1 file2
file3

Creates a directory

mkdir junk

Also allows you to designate where the


directory is to reside
Removes (deletes) file(s)

mkdir ~/left

rm -i file1 file2

Prompts before deletion of files


*****USE -i AT FIRST*****

rm -f file1 file2

Forces deletion without prompt


regardless of permissions
Remove a directory along with
anything inside it
Removes a directory like rm -r does if
the directory is empty
This combination will force the
removal of any file and any directory
including anything inside it

rm -r directory
rm -R directory
rmdir directory
rm -fR name
rm -Rf name
*dangerous*

Copyright 2005 CRC Press LLC

rm xyz
rm xyz abc
rm *
rm -i *

rm -f program
rm -r bin
rm -R bin
rmdir bin
rm -Rf c_ya

Moves you to the directory you just came


from
Each will move you to your home
directory (the directory you start from
initially)
Makes a directory named junk in your
current directory
Makes a directory in your home
directory named left
Deletes a file named xyz
Deletes the files named xyz and abc
Deletes everything nonhidden
Prompts at each nonhidden file and
lets you decide whether or not to
delete it
Removes the file program without
regard to permissions, status, etc.
Each will remove the bin directory and
everything inside of it
Removes the bin directory if it is empty
Forces removal without prompts of the
c_ya directory and anything inside it

AU2768_book.fm Page 223 Tuesday, November 16, 2004 2:17 PM

cd -

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

rm -Ri directory

Explanation

Example

End Result

Deletes the contents of a directory and


the directory if it is empty by
prompting the user before each
deletion

rm -Ri rusure

Deletes anything in the directory called


rusure that you verify at the prompt,
and if you remove everything in the
directory, you will be prompted
whether you want to remove the
directory itself or not

rmdir -p /
home/bin/dir1

Deletes the dir1 directory; if bin


directory is empty, it is deleted: if
home directory is empty it is also
deleted
Makes a copy of the file/directory
named old and names the copy new,
all within the current directory

Note: Options can be combined using rm.


rmdir -p
directory

cp file1
newname

Removes a directory and any empty


parent directories above it
(-pi does the same thing, but it
prompts before each removal)
Copies a file (file1) and names the copy
the new name (newname)

cp old new

Note: If you copy a file to a newfile name and newfile


already exists, the newfile contents will be overwritten.
cp file dir2/
cp ../dir1/* .

Copyright 2005 CRC Press LLC

Places a copy of file in dir2/ and it


retains its original name
Copies everything from the dir1
directory located just below where
you currently are and places the copy
here (.) in your current directory

AU2768_book.fm Page 224 Tuesday, November 16, 2004 2:17 PM

UNIX
Command

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Preserves all permissions in the


original to the target

cp -p execut1
execut2

cp -R directory
target
cp -f name
target
mv initial final

Copies a directory and names the copy


the new name (target)
Forces existing pathnames to be
destroyed before copying the file
Renames files and directories

cp -R old/ junk/

pwd
pr (option)
filename

pr +k filename

none
mv temp
script_1

Also moves files to other directories

mv script.exe ~/
bin

Allows multiple moves

mv script_1
script.exe ~/
bin
pwd

Prints the current directory to the


screen
Prints the specified file to the default
printer
Note: options are not required but can
be combined in any order.
Starts printing with page k

Copyright 2005 CRC Press LLC

Copies execut1 executable file and calls


the copy execut2, which also has
executable permissions
Makes a copy of the directory named
old and names the directory copy junk
No example or description needed
Renames the file
(or directory) temp to the name
script_1 in the current directory
Moves the script.exe file to the bin
directory that is in the home (~)
parent directory and it keeps its initial
name
Moves both script_1 and script.exe to
the bin directory
May print something like /home/bob

pr userlist

Prints the contents of userlist to the


default printer

pr +5 userlist

Prints the contents of userlist starting


with page 5

AU2768_book.fm Page 225 Tuesday, November 16, 2004 2:17 PM

cp -p name
target

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Explanation

Example

End Result

pr -k filename

Prints in k columns

pr -2 userlist

Prints the contents of userlist in 2


columns
Prints userlist in three columns across
the page
Prints userlist with double space format
Prints userlist with users as the header

pr -a filename

Prints in multicolumns across the page


(use with -k)
pr -d filename
Prints in double space format
pr -h header
Prints the file with a specified header
filename
rather than the filename
Note: Options can be combined using pr.
lpconfig
Configures remote printers to a local
printer_id
print queue
queue
lpconfig -r
Removes said queue from the local
queue
system

lpconfig -d
queue
lpstat (options)
lpstat -uuser1,
user2
lpstat s

Makes said queue the default queue


Prints printer status information to
screen (options not required)
Prints the status of requests made by
the specified users
Prints the queues and the printers they
print to

Copyright 2005 CRC Press LLC

pr -3a userlist1
pr -d userlist
pr -h users
userlist
lpconfig prntr1
bobprt
lpconfig -r
bobprt

lpconfig -d
vpprnt
lpstat
lpstat -ubob
none

Configures a printer named prntr1 to


accept print requests from a local
queue named bobprt
Removes bobprt queue from the local
system
if the person removing the queue is
the owner or root
Makes vpprnt the default print queue
Prints status of all requests made to the
default printer by the current server
Prints status of all requests made by the
user with the ID bob
None

AU2768_book.fm Page 226 Tuesday, November 16, 2004 2:17 PM

UNIX
Command

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

lpstat -t
lpstat -d
lpstat -r
lp (-option)
file(s)

lp -ddest file(s)
lp -nnumber
file(s)
lp -ttitle file(s)
lp -ooption
file(s)

Concise Explanations

Examples

End Result

Shows all print status information


Shows the default printer for the lp
command
Shows if the line printer scheduler is
running
Like pr, prints designated files on the
connected printer(s) (options not
required and options may be
combined)
Prints the file(s) to a specific
destination
Allows user to designate the number
of copies to be printed
Places title on the banner page

none
none

None
None

none

None

lp junkfile

Prints the file junkfile to the default


printer in default one-sided, singlesided, single-spaced format

lp -dbobsq
zoom
lp -n5 crash

Sends the file zoom to


the bobsq print queue to print
Prints five copies of
crash in default settings
Prints Bobs on the banner page of the
file printout named cash
Prints the output file double-sided on
the printout

Allows printer-specific options to be


used
(i.e., double-sided or two pages per
side, etc.)

lp -tBobs cash
lp -od output

lp -obold
output
lp -ohalf output
lp -oquarter
output

Copyright 2005 CRC Press LLC

Prints output in bold print


Divides the paper into two halves for
printing output
Prints four pages of output per side of
paper

AU2768_book.fm Page 227 Tuesday, November 16, 2004 2:17 PM

Unix
Commands

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Concise Explanations

Note: Options can be combined using lp.


cancel
Stops print jobs or removes them from
request_id
the queue (request_ids are obtained
using lpstat)
cancel -a
Removes all print requests from the
printer
current user on the specified printer

UNIX
Command

Examples

End Result

lp -olandscape
output
lp -oportrait
output

Prints output in landscape orientation

cancel 5438

Stops the print job with the id 5438


whether it is printing or if it is sitting
in the queue
Removes all the
requests from the current user to the
printer named bobsprt

cancel -a
bobsprt

Prints output in portrait orientation

Explanation

Example

End Result

cancel -u
login_id
ps

Removes any print requests queued


belonging to the user
Shows certain information about active
processes associated with the current
terminal

cancel -u bob
ps

ps -e

Shows information about all processes

ps -e

Cancels all queued print requests for


user bob
Shows a listing of
process IDs, terminal identifier,
cumulative execution time, and
command name
Shows a listing of process IDs, terminal
identifiers, cumulative execution
time, and command names for all
processes

Copyright 2005 CRC Press LLC

AU2768_book.fm Page 228 Tuesday, November 16, 2004 2:17 PM

Unix
Commands

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Shows a full listing of information


about the processes listed

ps -f

ps -u user_id

Shows all processes that are owned by


the person with the pertinent user_id
Shows all processes in a full listing

ps -u bob
ps -ef

kill process_id
kill -9
process_id
grep string file

Stops the process with the said id


Destroys the process with the said id

kill 6969
kill -9 6969

Searches input file(s) for specified


string and prints the line with matches

grep mike letter

grep -c string
file

Searches and prints only the number


of matches to the screen

grep -c hayes
bankletter

grep -i string
file

Searches without regard to letter case

grep -i hi file1

ps -ef

Copyright 2005 CRC Press LLC

Shows UID (user or owner of the


process), PID (process ID, use this
number to kill it), PPID (process ID of
the parent source), C (processor
utilization for scheduling), STIME
(start time of the process), TTY
(controlling terminal for the process),
TIME (cumulative time the process has
run), and COMMAND (the command
that started the process)
Shows all the processes that belong to
the person with the userid bob
Shows all current processes in full
listing
Kills the process with PID 6969
PID 6969 does not have a chance here
Searches for the string mike in the file
named letter and prints any line with
mike in it to the screen
Searches the file bankletter for the
string hayes and prints the number of
matches to the screen
Searches file1 for hi, Hi, hI, and HI and
prints all matches to the screen

AU2768_book.fm Page 229 Tuesday, November 16, 2004 2:17 PM

ps -f

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Explanation

Example

End Result

grep -n string
file

Prints to the screen preceded by the


line number

grep -n abc
alpha

grep -v string
file
grep -x string
file

All lines that do not match are printed

grep -v lead
pencils
grep -x time
meetings
ps -ef | grep
bob

Searches alpha for abc and prints the


lines that match and line numbers to
the screen
Prints all lines in pencils that do not
contain the string lead
Prints only lines in meetings that match
time exactly
Finds all processes in full listing and
then prints only the ones that match
the string bob to the screen
Searches the file b_days for caseinsensitive matches to jan and places
the matching lines into a file called
mymonth

Only exact matches are printed


grep is useful when used in a | pipe

Can also redirect its output to a file

grep -i jan
b_days>mymo
nth

Command

Description

Example

Explanation

vuepad
filename
vi filename

Opens filename for editing/viewing in


the vuepad editor
Text editor that exists on every UNIX
system in the world
Another text editor
Compresses the file to save disk space

none

None

none

None

none
none

None
None

emacs filename
compress
filename

Copyright 2005 CRC Press LLC

AU2768_book.fm Page 230 Tuesday, November 16, 2004 2:17 PM

UNIX
Command

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Expands a compressed file

none

None

UNIX programming language

none

None

Command

Description

Example

Explanation

eval `resize`

Tells the target computer that the


window has been resized during telnet
Keeps the file(s) from expiring (being
erased) on the target computer for #
days

none

None

chexp
365 nr*

Keeps the target computer from


deleting all files starting with nr for 1
year (365 days)
Makes all files whose name starts with
nr never expire or be deleted (infinite)
Shows the status of the requests
submitted by the invoker of the
command will print request-name,
request-id, the owner, relative request
priority, and request state (is it
running yet?)
Shows all requests
Shows requests in long format
Shows requests in medium-length
format
Shows only requests belonging to the
user bob
Queue header is shown in an extended
format

chexp #
filename

chexp 4095 nr*


qstat

Displays the status of a process that has


been submitted the Network
Queuing System (basically a batch
job)

qstat

qstat -a
qstat -l
qstat -m
qstat -u bob
qstat -x

Copyright 2005 CRC Press LLC

AU2768_book.fm Page 231 Tuesday, November 16, 2004 2:17 PM

uncompress
filename
awk

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Description

xterm

Opens a new window


(x-terminal) for you
to work
xterm -option
-option sets the option
xterm +option
+option resets the option to default
Note: Using xterm will eliminate desktop clutter. I
strongly recommend learning to use it in your scripts.
xterm -help
Displays the xterm options
xterm -e
Executes the listed program in the new
program
xterm window; when the program is
finished, the new xterm window goes
away
xterm -sb
Opens an xterm that saves a set
number of lines when they go off the
top of the page and makes them
accessible with a scroll bar
Note: When clicking in the scroll bar, the left button
scrolls down, the right scrolls up, and the middle snaps
the scroll bar to the mouse position for dragging up and
down.
xterm -sl
Specifies the number of lines to be
number
saved once they go off the top of the
screen (default is 64)

Copyright 2005 CRC Press LLC

Example

Explanation

xterm

This opens another window like the


one you are currently working in.

xterm -help
xterm -e
myprog.exe

Shows the options available


Opens an xterm window and executes
the program myprog.exe from that
window so that you may still work in
your present window
Puts a scroll bar on the right side of the
page for reviewing past lines in the
window

xterm -sb

xterm -sl 1000

xterm will save 1000 lines of work once


it has moved off the immediate
viewing area; it can be accessed using
the scroll bar

AU2768_book.fm Page 232 Tuesday, November 16, 2004 2:17 PM

Command

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Option allows you to specify the size x


pixels by y pixels and placement
position x by position y of the new
window when it opens
Position +0+0 is the top left-hand
corner of the screen; and the bottom
right is approx. +1200+1000 depending
on the resolution
Note: The size of the window takes precedence over
position, so if you position it too close to the side of the
screen, it will position at the edge with the correct size.

xterm -geom
80x80+0+50

First command will open a window 80


pixels wide by 80 pixels tall and
position its top left-hand corner at 0
pixels to the right of the left edge and
50 pixels down from the top of the
screen

xterm -geom
10x35+300+5
00

Second command will open a window


10 pixels wide by 35 pixels tall and
position its top left-hand corner 300
pixs from the left edge and 500 pixs
down from the top.
The third command will make a 5 by 5
window and position its top
left-hand corner at the top left-hand
corner of the screen.
xterm will not compromise size when
positioning.
Opens an xterm window with the title
SCRIPTS (default is whatever follows
the -e option)
First command sets
the background color
to white

xterm -geom
5x5+0+0

xterm -title
label

Allows you to label your windows top


title bar

xterm -title
SCRIPTS

xterm -(areas)
color

Allows you to modify different colors


in your xterm window

xterm -bg white

Copyright 2005 CRC Press LLC

AU2768_book.fm Page 233 Tuesday, November 16, 2004 2:17 PM

xterm -geom
xxy+px+py

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

xterm -fn font

Description

Sets the font in the new xterm window

xterm -iconic

Starts the new xterm as an icon


(double-click to maximize)
Note: Options can be combined using xterm.

Example

Explanation

xterm -bd
huntergreen
xterm -fg red

Second command sets the window


border color to huntergreen
The third command window sets the
text color to red
Sets the font to courr18 (default is
fixed)
Opens an xterm in iconic form with the
title xyz

xterm -fn
courr18
xterm -iconic title xyz

Command

Description

alias dir ls

Enables typing of either dir or ls to obtain a directory


listing. (Note: I can substitute any word in place of dir.
I can even use the word mouse. Therefore, now when
I type the word mouse at the command line, it would
do what the command ls would normally do.)
Displays all defined aliases.
Now dir will no longer work as a command to be used
in place of ls.
Now I only have to type h instead of the entire
command history. The history command gives a list
of the commands that have been typed on the system
(a certain number of them, depending on how history
was configured).
Backs up the current directory (.) and stores the resulting
archive on the diskette in a:

alias
unalias dir
alias h history

tar -cvf a:archive .

Copyright 2005 CRC Press LLC

AU2768_book.fm Page 234 Tuesday, November 16, 2004 2:17 PM

Command

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Description

tar -cvf a:archive *.doc


tar -cvf a:archive -

Backs up every file with the .doc suffix.


Used when you want to type filenames from the keyboard
(standard input). Type each filename on a separate line.
^Z indicates end of list.
Produces a list of all files currently contained in the
archive.
Identify any files that have changed in the last 7 days.
Place these filenames in weeklist.
Backup all files in weeklist.
Does the same thing that the above
2 commands do, but does it using
a pipe (the | symbol).
Disk space usage on a file system
Disk space used by a directory
Check to see if you are running ftp services:
Begins the search at the root directory
(/) and look for anything (*) ending with and s and print
it to the screen.
Finds all core files more than 7 days since last access and
removes them. Core files are important since they
contain information relating to the failure of a system or
an application running on that system.
Returns all the files that have been changed fewer than
2 days ago

tar -tf a:archive | more


find / -ctime -7 > weeklist
tar -cvf a:archive - < weeklist
find / -ctime -7 | tar -cvf a:archive -

df
du
grep -i ^ftp /etc/inetd.conf
find / -name *s -print

find / -name core -atime +7 -exec rm -f {}|;

find / -ctime -2 -print

Copyright 2005 CRC Press LLC

AU2768_book.fm Page 235 Tuesday, November 16, 2004 2:17 PM

Command

Downloaded by [Universidade Estadual de Campinas - UNICAMP (CRUESP)] at 09:13 07 July 2015

Description

find /users/jake -exec chown jake {} \;

Makes the user jake the owner of the directory/users/jake


and everything underneath it
Finds file owned by a user not listed in /etc/group
Finds files owned by a user not listed in /etc/passwd
Examines disks to ensure consistency of the information
they contain. Checks all file systems listed in /etc/fstab.
0 = successful
fsck -p /dev/rra1h (in rc.boot)
BSD: /etc/fstab /etc/filesystems in some flavors
ATT: /etc/checklist
File Transfer Protocol: used to open communications to
another computer system. Allows transfer of files to/
from that system. Use as follows (type the words in
italics):
ftp <then press the enter key>
ftp> open
(to) TMG1 <note that TMG1 is the name of the system
you want to open communications with>
Name: Bruce1 <Bruce1 is your userID on TMG1>
Password: tsili30m
230 User Bruce1 Logged In
ftp>

find / -nogroup -print


find / -nouser -print
fsck

ftp

Copyright 2005 CRC Press LLC

AU2768_book.fm Page 236 Tuesday, November 16, 2004 2:17 PM

Command

You might also like