Short reference
(Commands, Directories, Configuration files/Scripts)

Linux command

Description

example

start example where example is a

program found in the $PATH

./example

start example (allocated in current dir.)

adduser

add a user

rmuser

remove a user

passwd

change password

cd x or cd /x

go to directory x

cd .. or cd ../ or cd /..

go back one directory

ls or dir

list a directory

cat

display a textfile on the terminal


Examples:


cat /proc/meminfo - more memory info

cat /proc/pci - list pci devices, interrupts, io

cat /proc/cpuinfo - cpu info

cat /proc/version - kernel and gcc version info

cat /proc/ioports – input/output range of devices

mv x y

move or rename file x to file y

cp x y

copy file x to file y

rm x

delete a file


rm -r /old_stuff - correct

rm -r / old_stuff – common mistake leaving space between / and the directory name. This will wipe your system

mkdir x

make a directory

rmdir x

remove a directory

rm -r x

remove directory x and all its underlying files

df or df x

Show free space on device x

top

view memory status (q to quit)

man x

get a manual page about command x

less x or more x

view text file x

echo

print something on the screen

mainly used in scripts

mc

similar to Norton Commander in DOS

mount

to make a device usable to the system (CD-ROM,other HDD)

umount

remove the device from being usable to the system

halt

to shutdown. It will also power off if APM or ACPI is being used

reboot or ([ctrl] + [alt] + [del])

to reboot the system

chmod <permissions> <file>

change file permissions

chown <owner:group> <file>

change file ownership

ls -l x

perform a detailed directory listing for file or directory x

ln -s x y

make a symbolic link to x called y

find x -name y -print

find file y, begin the search from within directory x and print the results to the screen

ps

to view all running processes

kill x

to terminate process x (x is PID from ps)

killall -KILL pgm

to kill the program called pgm

killall -HUP pgm

to force program pgm to restart - used in case configuration is changed

lilo

to write boot information changes to disk

ldd

shows the needed shared libraries

ldconfig

updates shared libraries

lsmod

shows loaded modules


Linux directories

Directory function

/

the root of the directory tree

/dev

the device pointer directory all devices have an entry here

/bin

main CLI executables

/sbin

main CLI system executables

/boot

location of the kernel and boot information required to boot the system

/etc

system configuration files

/root

root user home directory

/home

normal user base directory

/lib

system libraries and kernel modules

/usr

main user binary,documentation, library location eg. XFree86 and other X apps are here

/opt

extra binary/documentation,library location - eg.KDE

/var

system log files,spoolers,etc

/tmp

temporary folder for running applications that need temp files

/proc

includes files with information about the system

/mnt

filesystem mount point for devices (cdrom, usb etc.)


Linux configuration/script file

Description

/etc/lilo.conf

boot loader configuration file – you must run "lilo" after any changes

/etc/modprobe.conf

kernel module loader configuration used by the modprobe command

/etc/inittab

system runlevel configuration file - tells init what to do for each runlevel

/etc/fstab

filesystem mounting configuration file - used by the mount command

/etc/ld.so.conf

library configuration file - used by the ldconfig command to find libraries

/etc/inetd.conf

tcp wrapper configuration - used to start ftp and other network daemons

/etc/hosts

local host resolution file - manually enter hosts you want to connect to if they are not on DNS

/etc/HOSTNAME

system hostname file

/etc/profile

system defaults for bash login default paths,colours,etc

/etc/rc.d/rc.0

system halt script - run when you issue halt

/etc/rc.d/rc.6

system reboot script - run when you issue reboot or [ctrl] + [alt] + [del]

/etc/rc.d/rc.K

runlevel 1 or system administration mode

/etc/rc.d/rc.S

main system boot script - run when you boot up

/etc/rc.d/rc.M

main local startup script - activates other services you have chosen

/etc/rc.d/rc.sysvinit

SysV Init script starter

/etc/rc.d/rc.inet1

network startup script

/etc/rc.d/rc.modules

system module loader - run at startup

/etc/rc.d/rc.hotplug

hotplug starter script - for USB and PCI hotplug devices

/etc/rc.d/rc.pcmcia

pcmcia service script - for use with laptops

/etc/rc.d/rc.local

local startup script for user space programs

/etc/X11/xorg.conf

Xorg configuration file