index --> comp --> *nix

*nix CLI Commands

Quite simply a list of command line interface commands that can be used in *nix systems. Many of these commands are similar to DOS commands, and are currently listed below their *nix equivalents, but they may be moved to a more general section as the list grows (with links to this page and a planned page in the Windows section).
Switches can be combined, putting all switches after the hyphen.

The basic commands are listed first, after which will be some more complex strings (towards the end of this page will eventually be more esoteric strings involving less common programs, put here just so I have somewhere I can refer to them).

ls list
$ls # lists contents of directory
$ls -F # appends a forward slash to subdirectory names
$ls -a # shows hidden files (those beginning with a '.'
$ls -l # shows detailed information, includes permissions, owners, size, date last modified
$ls -al # combines -a and -F (?)

(Roughly) equivalent to dir in DOS

cd change directory
$cd <dir> # changes active working directory to <dir>

Equivalent to cd in DOS

pwd print working directory
$pwd # displays current location in directory structure

mkdir make directory
$mkdir <dir> # creates a directory <dir> in current working directory

Equivalent to md or mkdir in DOS

rmdir remove directory
$rmdir <dir> # deletes directory <dir>

Equivalent to rd or rmdir in DOS

cp copy
$cp <file> <newfile> # copies <file> to <newfile>
$cp <dir/file> <newdir/newfile> # copies directory structure with file

Equivalent to copy in DOS

mv move
$mv <file> <newfile> # renames file
$mv <dir/file> <newdir/file> # moves file to new directory
$mv <dir/file> <newdir/newfile> # moves file to new directory and renames file

Equivalent to move and rename in DOS

rm remove
$rm <file> # deletes <file>

Equivalent to del in DOS

grep global regular expression and print
$grep "<foo>" <file> # searches for <foo> inside the file called <file>
& grep "<foo bar>" * # searches for the string <foo bar> inside all files in current working directory

$zip <> <:foo> <bar> # compresses files <foo> and <bar> into zip format archive file called <>

Equivalent to pkzip in DOS

$unzip <> # extracts files from zip format archive files called <>

Equivalent to pkunzip in DOS

passwd password
$passwd # causes prompt to change password, entering old password first - password will not be echoed on screen in any way

chmod change mode
$chmod 750 <foo.cgi> # changes permissions for cgi script <foo.cgi> to executable
owner group other
7 = read, write and execute
5 = read, execute (not write)
0 = no access to files

Add the following numbers for which permissions you wish to grant:
1 = execute
2 = write
4 = read

man manual
$man <foo> # prints manual <foo> to screen


apropos # what is appropriate



whereis perl

cat /etc/mandrake-release

uname -r # returns kernel version

startx # starts graphical interface

XFdrake # configure graphic card if startx doesn't work

soundwrapper frozen-bubble

service network restart


locate -i parameters

df # checks free space of partitions


cardinfo # sees how the card advertises itself

ls -al

xterm -e vi &

tmpwatch -vs 5 /tmp # cleans up any files older than five
 hours which aren't currently open
 and prints a list of deleted files

kdirstat # kde? directory? status?

urpmi.update --update && urpmi --auto-select --update

urpmi.removemedia -a # don't do this as you will lose
 cd sources

urpmi.addmedia --distrib cdrom removable://mnt/cdrom

cd /home/sheridan
cp -R /mnt/cdrom/* cdrom1 #having inserted disk 1
 into cdrom drive

update-menus -v # as root

lsof -V /dev/tty0

rm /var/lib/rpmrebuilddb.3776/*
rmdir /var/lib/rpmrebuilddb.3776

dmesg | grep hdc/CD # finds out about cd errors?

mount -t iso9660 /dev/hdc /mnt/cdrom

# installing self extracting rpm.bin files
chmod +x .bin # as root
rpm -Uvh .rpm.bin # alternative
./.bin # to run
sh .bin # to run alternative

sh j2re-1_4_2_01-linux-i586-rpm.bin
urpmi j2re-1_4_2_01-linux-i586.rpm
ln -s /usr/java/j2rel.4.2.01//plugin/ns610/

cp /etc/samba/smg.conf /etc/samba/smb.conf.orig
 # backup samba configuration files


mkinitrd -f  
mkinitrd -f initrd-2.4.21-0.13mdk.img 2.4.21-0.13mdk

urpmi kernel-source

urpmi --media main kernel-source

rpm -qa | grep top

top # shows all processes
top -i # shows all non-idle processes
shift < # switches which column top sorts by
shift >

cdrecord -atip dev=0,0,0 # checks cdr manufacturer?
 if burner is scd0

rpm -qa | grep -i aumix

make menuconfig


dd if=favicon.ico skip=2238 bs=1 (Unix command)




tail -f /var/log/messages


cd public_html
mkdir s1
cd s1


Checking Server Space Usage

You can find out how much space is in use
 by the www files for your domain by using
 Telnet to log into your account and
 then from the Unix prompt, typing the following:

du -s /www/htdocs/yourdomain

This will give you a report back of the
 number of kilobytes (k) all files in your
 www directory add up to.

If you have an anonymous FTP area, also check:

du -s ~ftp/

To check how much space is being used by
 files in your home directory, type:

du -s $HOME

Adding up the results from all three of these 
commands will give you the total amount of 
space you are using, but a simpler way 
of checking all three directories is to type:

du * www/* anonftp/* -c

You will then see a space report for each directory
(-a to see for each file) and at the end, a total.


df -k # something to do with partitioning?


last updated: 2004-02-10t09:17z