I haven't updated my command cheat sheat quite a while, but well today I found some time. Have fun hope it helps - Yuriy.
Short reference - Linux
(Commands, Directories, Configuration files/Scripts)
(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
|
pwd
|
Show
current directory
|
ls or dir
|
list a directory
|
ls -al
|
Formated
listing with hidden files
|
date
|
Show
current date/time
|
cal
|
Show this
months callender
|
uptime
|
Show
uptime
|
w
|
Display
who is online
|
whoami
|
Who are
you logged in as
|
uname -a
|
Show
kernel config
|
df
|
Show disk
usage
|
du
|
Show
directory space usage
|
du -sh
|
Human
readable size in gigabyte
|
free
|
Show
memory and swap usage
|
whereis app
|
Show
possible locations of an app
|
which app
|
Show which
app will be run by default
|
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
cat
/proc/devices - Displays various
character and block devices that are currently configured.
cat
/proc/filesystems - Lists all file
system types currently supported by the kernel.
cat /proc/mdstat - Contains
current information on multiple-disk or RAID configurations on the system, if
they exist.
cat /proc/mounts - Lists all
mounts currently used by the system.
cat /proc/partitions - Contains
partition block allocation information.
|
cat >
file
|
place
standart input into a file
|
touch file
|
create or
update file
|
more file
|
Displays
the file - paging through text one screen at a time
|
less file
|
Displays
the top of the file you can use the arrow keys and the Page-Up and Page-Down
keys to move through the file
|
head file
|
first 10
lines of a file.
|
tail file
|
last 10
lines of a file
|
tail -f
file
|
output
contents of a file as it grows
|
mv x y
|
move or rename file x to file y
|
cp x y
|
copy file x to file y
|
rm -f x
|
force remove
a file
|
rm -rf dir
|
rm -rf /old_stuff - correct
rm -rf / old_stuff – common
mistake leaving space between / and the directory name. This will wipe your
system
|
mkdir x
|
make a directory
|
mkdir x
|
make a directory
|
rmdir x
|
remove a directory
|
rm -r x
|
remove directory x and all its underlying files
|
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 file link
|
make a symbolic link to "file" called "link"
|
top
|
view memory status (q to quit)
|
ps
|
to view all running processes
|
ps aux
|
ps with
mored detail
|
kill x
|
to terminate process x (x is PID from ps)
|
kill pid
|
kill
processes with pid 'pid'
|
killall -KILL pgm
|
to kill the program called pgm
|
killall -HUP pgm
|
to force program pgm to restart - used in case
configuration is changed
|
killall
proc
|
Kill all
processes named proc
|
bg
|
List
stoped/background jobs, resume stopped job in the background
|
fg
|
Bring most
recent jobs to foreground
|
fg n
|
Brings job
m to foreground
|
lilo
|
to write boot information changes to disk
|
ldd
|
shows the needed shared libraries
|
ldconfig
|
updates shared libraries
|
lsmod
|
shows loaded modules
|
Searching
|
Description
|
find x -name y -print
|
find file y, begin the search from within directory x and
print the results to the screen
|
grep
pattern files
|
Search for
pattern in files
|
grep -r
pattern dir
|
Search
recursively for pattern in dir
|
command |
grep pattern
|
Search
recursively for pattern in dir
|
locate
file
|
Find all
instances of file
|
Networking
|
Description
|
whois
domain
|
Get whois
for domain
|
dig domain
|
Get DNS for
domain
|
dig -x
host
|
Reverse
lookup host
|
wget -c
file
|
Continue
stopped download
|
wget -r
url
|
Recursively
download files from url
|
ssh
user@host
|
Connect to
host as a user
|
ssh -p
port user@host
|
Connect
using port p
|
ssh -D
port user@host
|
Connect
and use bind port
|
sshfs
name@server:/path/folder /path/mount
|
Mount
filesystem over ssh
|
ssh -t
reachable_host ssh unreachable_host
|
Ssh trough
host in the middle
|
python -m
SimpleHTTPServer
|
Server
current directory at http://$HOSTNAME:8000
|
|
|
|
|
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
|
Directories/files
|
Permission
|
Description
|
/var/log
|
751
|
Directory containing all log files
|
/var/log/messages
|
644
|
System
messages
|
/etc/crontab
|
600
|
System-wide
crontab file
|
/etc/syslog.conf |
640
|
Syslog
daemon configuration file
|
/etc/logrotate.conf
|
640
|
Controls
rotating of system log files
|
/var/log/wtmp
|
660
|
Who
is logged in now. Use who to view
|
/var/log/lastlog
|
640
|
Who
has logged in before. Use last to view
|
/eto/ftpusers
|
600
|
List
of users that cannot FTP
|
/etc/passwd
|
644
|
List of the system’s user accounts
|
/etc/shadow
|
600
|
Contains
encrypted account passwords
|
/etc/pam.d
|
750
|
PAM
configuration files
|
/etc/hosts.allow
|
600
|
Access
control file
|
/etc/hosts-deny
|
600
|
Access
control file
|
/etc/lilo.conf
|
600
|
Boot
loader configuration file
|
/etc/securetty
|
600
|
TTY
interfaces that allow root logins
|
/etc/shutdown.allow
|
400
|
Users
permitted to ctrl-alt-del
|
/etc/security
|
700
|
System
access security policy files
|
/etc/rc.d/init.d
|
750
|
Program
start-up files on Red Hat systems
|
/etc/init.d
|
750
|
Program
start-up files on Debian systems
|
/etc/sysconfig
|
751
|
System
and network config files on Red Hat
|
/etc/inetd.conf
|
600
|
Internet
SuperServer configuration file
|
/etc/cron.allow |
400
|
List
of users permitted to use cron
|
/etc/cron.deny
|
400
|
List
of users denied access to cron
|
/etc/ssh
|
750
|
Secure
Shell configuration files
|
/etc/sysctl.conf
|
400
|
Contains
kernel tunable options on recent Red Hat
|