| Linux Commands |
Usage |
Explanation of commands (some
commands may require full paths; some may not work on your system at
all) |
|
~~~~~~Text
Editing/Viewing~~~~~~ |
| less filename |
less list.txt |
displays the contents of a file and
allows you to view them one page at a time |
| more filename |
more list.txt |
displays the contents of a file and
allows you to view them one page at a time |
| cat filename |
cat list.txt OR cat accounts |
displays the contents of a file or
folder |
| pico filename |
pico list.txt |
text editor that allows you to view and
edit files |
| emacs filename |
emacs list.txt |
text editor that allows you to view and
edit files |
| vi filename |
vi list.txt |
much like pico and emacs, but much more
powerful and versatile |
| ed filename |
ed list.txt |
text editor, much like pico and emacs |
| head filename |
head list.txt |
displays the first 10 lines of a file |
| tail filename |
tail list.txt |
displays the last 10 lines of a file |
| sort filename |
sort list.txt |
displays the contents of a file in a
sorted order |
|
~~~~~~File
Editing/Management~~~~~~
|
| rm filename |
rm trash.pl |
removes/deletes a file |
| rm -rf filename |
rm -rf trash |
removes a directory as well as any
files/folders contained within the specified directory |
| cp filename |
cp list.txt ~pengen/list.txt.bak |
copies files, either within the same
directory or to another directory |
| mv fileA fileB |
mv list.txt list.txt.bak |
moves/renames files |
| mkdir directoryname |
mkdir newfolder |
creates new directories |
| rmdir directoryname |
rmdir oldfolder |
deletes a directory (directory must be
empty for this to work) |
| ln filename new -link |
ln cgi-bin new -link |
creates a hard link to an existing file |
| ln -s filename new -link |
ln -s cgi-bin new -link |
creates a soft link to an existing file |
|
~~~~~~File
Listings/Information~~~~~~
|
| info |
info OR info netscape |
displays information about shells,
programs or utilities (you have to specify what you want info on) |
| grep string filename |
grep domain.com /var/www/conf |
will search a file or folder(s) for a
specific instances of words or strings |
| diff fileA fileB |
diff list.txt some.mp3 |
will display the differences between
two files |
| file filename |
file list.txt |
displays information about a file and
its contents |
| stat filename |
stat list.txt |
displays statistical information about
a file and its contents |
| dir |
dir |
lists the contents of the directory you
are in |
| vdir |
vdir |
lists the contents of the current
directory as well as any file attributes |
| wc filename |
wc list.txt |
will count the number of characters,
words, lines in a file |
| cmp fileA fileB |
cmp list.txt some.mp3 |
will list the first place where fileA
and fileB differ from one another |
| ls |
see below for SOME examples |
lists contents of the current directory |
|
ls -a |
lists all files |
|
ls -l |
long listing, includes file attributes |
|
ls -al |
lists all files and their attributes |
|
ls -s |
lists all files and rounds their size
to nearest kilobyte |
|
ls -S |
lists files according to size |
|
ls -C |
list displays in columns (if current
terminal size allows) |
|
ls -F |
places a symbol next to files to
indicate file type |
|
ls -r |
lists files in reverse order |
|
ls -R |
recursive listing, includes not only
files directly within current directory, but also files contained in any
subdirectories |
|
ls -t |
lists files according to their time
stamps |
|
ls *.mp3 (or other file extension) |
lists all files matching the specified
extension |
|
~~~~~~Compression/Decompression~~~~~~
|
| gzip filename |
gzip mp3s |
compresses a file/folder |
| compress filename |
compress mp3s |
compresses a file/folder |
| zcat filename |
zcat mp3s.gz |
displays the contents of a compressed file |
| gunzip filename |
gunzip mp3s.gz |
decompresses a compressed file |
| tar -zxvf filename |
tar -zxvf mp3s.tar.gz |
will decompress a tar'ed and compressed file |
|
~~~~~~Remote
Connections~~~~~~
|
| rlogin hostname |
rlogin remote.host.net |
utility used to connect to a remote computer |
| telnet hostname |
telnet remote.host.com |
utility used to connect to a remote computer, must more
interactive than rlogin |
| ftp hostname |
ftp domain.com |
utility/protocol used to transfer files from a local
computer to a remote computer and visa-versa |
| ssh hostname |
ssh brahill@fifth.mspring.net |
used much like telnet or rlogin to
connect to a remote computer, only it is done in a much more secure
manner |
|
~~~~~~Printing~~~~~~ |
| lpr filename |
lpr list.txt |
sends a file to the printer queue |
| lpq |
lpq |
displays a list of files in the
printing queue |
| lprm filename |
lprm list.txt |
removes a file/job from the printing
queue |
|
~~~~~~System Management~~~~~~ |
| dmesg |
dmesg |
displays the kernel ring buffer |
| df |
df |
displays all mounted file systems |
| ps |
ps |
reports process status for a processes
being run out of a specific terminal |
| command & |
gaim & OR netscape & |
sends a job/process to the background
when you run it, it is then assigned a process number and it takes a
lower priority in processing/memory usage |
| top |
top |
displays an updating list of running
processes |
| tty |
tty |
displays the name of a terminal in what
a process/command was issued as well as the path |
| jobs |
jobs |
displays a list of current running
processes for a specific terminal |
| kill PID or job # |
??? |
aborts the specified process by PID or
job # |
| du |
du |
shows amount of memory being used and
by what |
| ifconfig |
ifconfig OR /sbin/ifconfig |
gives you the configuration info for
your machine (network configurations and so forth) |
| nice command |
nice netscape |
runs a process/command at a lower
priority so it takes less of a toll on system resources |
|
~~~~~~Useful
Commands~~~~~~
|
| passwd |
passwd follow steps after that |
change the password for the current user |
| man command |
man more OR man |
displays the linux manual pages for a specific
command (enter just 'man' for more assistance') |
| xman |
xman |
displays the linux manual pages in X (essentially a GUI) |
| clear |
clear |
clears a full or cluttered terminal |
| pwd |
pwd |
present working directory, will show what directory you
are in by the path |
| apropos command |
apropos more |
searches all of the man page topics/headings for the
specified command and lists any relevant man pages |
| lynx |
lynx alienated.org |
text based web browser |
| whoami |
whoami |
tells you whatever user it is that you are logged in as |
| which command |
which traceroute |
displays the path to the specified command |
| locate command |
locate traceroute |
works the same as which, will show you the path to the
specified command |
| whereis command |
whereis traceroute |
displays the path to the command, its binary source and
its man page(s) |
| who |
who |
lists all users currently logged in to a given computer
(try this on fifth, for example) |
| w |
w |
lists all users currently logged in to a given computer
and the processes they are running |
| hostname |
hostname |
displays the systems hostname |
| find folder file |
find ~pengen/ list.txt |
will search the entire computer ( / ), or just a specified
folder (and all subfolders), for a specific file |
| cd foldername |
cd /var/conf/www |
changes to a specific directory |
| cd .. |
cd .. |
changes to the directory one level up |
| date |
date |
displays the date and time |
| cal |
cal or cal 2000 |
displays the calendar for the current month or for a
specified year |
| help |
help |
will display a list of topics in which this command can
help you locate more information on |
| chfn |
chfn follow instructions |
allows you to change the 'finger' information for your
computer under the current login |
| finger user |
finger brahill |
will retrieve information about a specified user |
| chage user |
chage pengen |
will set an expiration date on a users password, can only
be used by someone with root access (please don't ask what root is, if
you do, I will find you and laugh at you heartily, I'll bring a camera
too, and people...I swear it!) |