Commands and references ( linux kernel 2.4.18-3 )   
Linux is a registered trademark of Linus Torvalds

Valid HTML 4.01!

These are just a few of the most common Linux commands that you may find yourself looking for.
The commands are in brackets like this: [ commands ]
You will need to be root to use some of these commands. Many of these commands will also work in Unix. If you get an error message when you type the command it most likely means you need to be root to execute the command. Be careful as root , you can make your system unusable. Any comments are encouraged and welcome at

Perpetual PC's home page
Perpetual PC's link page

add new disk drive:

First: [ fdisk /dev/hda ] gets you to fidisk on first harddrive [ fdisk /dev/hdb ] is second hdd. Then: [ mkfs /dev/hda1 ] formats the partition. Add your directory [ mkdir /new ] Next: edit /etc/fstab ; add the line /dev/hdb1 /new ext2 defalults 1 1 [ mount -a ] as root mounts all partitions in fstab.

apache start

usually located in /etc/rc.d/inet.d/ as httpd command can be [ httpd start ] [ httpd stop ] [ httpd reload ]

apache virtual domain setup

Put your virtual domain dir in /usr/local/apache/haljrdocs haljrdocs being the hostname of your machine plus the word docs. This is the directory that your index.html file goes in. You can just about leave everything in httpd.conf the way it is except < Virtual Host > towards the end of the file about line 900 or so.There you want : < NameVirtualHost > the number being your assigned ip address. Then 6 lines down: < Virtual Host > server Alias haljr DocumentRoot /usr/local/apache/haljrdocs ServerName ErrorLog logs/haljr_error_log < /VirtualHost >

balsa setup

The smtp server must be set to localhost:25 because balsa defaults to a different port.

change group of all in directory

[ chgrp -R groupname /directoryname ]

change history size


change ownership of dir and all files

[ chown -R username /directoryname ]

change time/ date stamp of file called filename

[ touch -t filename ]

Command to make file foo owned by user

[ chown user /home/foo ] makes the dir foo owned by user

compare 2 sorted files line by line

[ comm file1 file2 ]

compare files

[ diff file1 file2 ]

cooked    in other words ; formatted output on the command line

[ stty cooked ]

copy all files in dir to anotherdir

[ cp -r dir/* anotherdir ]

convert files for printing

[ pr ]

create an empty file called filename

[ touch filename ]

fix unrecognized cdrom drive in RedHat 7.2

[ depmod -ae ]

display bootup messages

[ dmesg ]

display current directory files and permissions

[ ls -ld ]

display environment variables

[ env ]

display last line first of file called filename

[ tac filename ]

[ fdisk ]

type this as root for linux fdisk program
follow help carefully you can make your hard disk unreadable if you are not careful

get processor type

[ uname -m ]

host name example:

image magic

[ display ]

invoke previous command

[ !! ]

line , word , byte count of a file

[ wc ]

linux bootdisk for system

[ mkbootdisk --device /dev/fd0 2.4.18-3 ]
[ uname -r ] gets you the version number

list all in current dir and alll below

[ ls -R ]

list all partitions on all drives

[ sfdisk -l ]

list in color

[ ls --color ]

not so primitive calculator

[ bc ]

"opera needs"

install openmotif. Its on disk 2 of 3 in Red Hat 7.3

primitive calculator

[ dc ]

print a manual entry for subject

[ man subject | lpr ]

printer jobs and status

[ lpstat -t ]

printer jobs status

[ lpstat ]

print terminal line settings

[ stty -a ]

print working directory

[ pwd ]

process on port 22 BSD

[ ps -lt 22 ]

process on port 22 system 5

[ ps -ft 22 ]

raw     unformatted output on command line

[ stty raw ]

remove all in directory recursively

[ rm -r ]

remove duplicate lines from file

[ uniq ]

resize windows if size is wrong

[ reset ]

rpm get version and release

[ rpm -q -p ]

rpm install

[ rpm -ivh ] gives messages

rpm list files in a package

[ rpm -q -l ]

rpm query

[ rpm -q ]

rpm query all

[ rpm -q -a ]

rpm query and give info

[ rpm -q -i ]

rpm which package owns a file

[ rpm -q -f ]

run levels

[ 0 is halt ] [ 1 is single user w/o nfs ] [ 2 is multi user w/o nfs ]
[ 3 is multi user w nfs ]
[ 4 is unused ] [ 5 is X windows ] [ 6 is reboot ]


Encrypted passwords. Create /etc/smbpasswd. Make sure < encrypt passwd > and < samba password file > are uncommented in smb.conf


to add user [ smbpasswd -a userid ]


Mount win98 or win95 shared resource from linux   [ smbmount //ada/ada_c /mnt/ada_c ]   where ada is the name of the windows computer and ada_c is the name of the windows drive share. /mnt/ada_c is the name of the directory you create on your linux machine. The resource must be shared at the winbox and the winbox must be configured for networking.   [ smbclient \\\\ada\\ada_c ]   gets you to a password prompt for the share. Then you will get smb: \ if you typed the correct password.


On win2k be sure your share includes the name of your workbroup. Kep it the same as in the samba flle. On the win2k share put workgroup < mygrp > as one of the authorized users in your smb.conf file list the workbroup as < mygrp > and put the ip of your win2k host in your /etc/hosts file.


[ smbclient -L ada ] gets you to password prompt then a listing of all shares on ada


To make a share work. You must create the directories in your system exactly as they are described in the smb.conf file.then set ownership of the directory with the chown command to make it visible to owner the command prompt you could type [ chown someone /usr/ someone/shared ] this makes the directory shared only visible to someone.

set date / time

[ date 08021400 ] sets to august 2 at 2:00 pm

set gid

[ chmod g+s ]

[ set serial ]

changes the irq of a serial port

set uid

[ chmod u+s ]

set uid and gid

[ chmod +s ]

set uid and gid and rwx for all in dir

[ chmod a=rwx,+s * ] not recomended very dangerous

set uid and unset gid

[ chmod u+s,g-s ]

[ setup ]

typed at prompt in Red Hat linux gets you to a configuration menu

slackware bootdisks

Format the floppies in linux use the dd command for both bootdisk and rootdisk do as follows:
[ dd if=bare.i of=/dev/fd0 obs=18k ] and [ dd if=color.gz of=/dev/fd0 obs=18k ]

slackware setup

go to series >a< and select one kernel to install use expert mode for this

stop ppp0

[ ifconfig ppp0 down ]

stop ppp daemon

[ killall pppd ]


In free BSD edit    /etc/group    and change the line   wheel:*:0root   to   wheel:*:0root,youruserid   do not add any spaces


to activate swap [ mkswap /dev/hdc1 ]

unset gid

[ chmod g-s ]

unset uid

[ chmod u-s ]

usb floppy

mount as /dev/sda edit fstab:
/dev/sda /mnt/floppy auto sync,user,noauto,nosuid,exec,nodev 0 0


The gvim.rc and vim.rc go in /home/userid as .gvimrc or .vimrc

vim colors:

Use the example in gvimrc_example.vim and follow the directions. These two files control the colors: Synload.vim and colortest.vim. You can change syntax highlighting in these files after you do the above installation.

what is default file permission

[ umask ]

print the file name of the terminal connected to standard input

[ tty ]

zipped tar : to unzip and untar a file named filename type:

[ tar -xzf filename ]

Perpetual PC's home page

Perpetual PC's link page