Linux Commands

Mounting directory:

sudo mkdir /media/www
sudo mount //server/www /media/www

In /etc/fstab:

//server/www /media/www smb defaults 0 0

—–

Compress/Decompress:

tar -cjf backup.tar.bz2 directory
tar -xjf backup.tar.bz2

—–

Restart System / Apache / PostgreSQL / MySQL

shutdown -r now
sudo /etc/init.d/apache2 restart
sudo /etc/init.d/postgresql-8.2 restart
sudo /etc/init.d/mysql restart

—–

IP:

ifconfig / iwconfig
ip addr show
ip route

—–

Restart X-Server: Ctrl-Alt-BackSpace

—–

Linking:

ln -s target/path name

—–

All services: ps aux
Filtered services: ps aux | grep servicename

Search the whole file system: find / -name filename

Copy dir: cp -r dir/* dest/dir

Example /etc/network/interfaces:

auto lo
iface lo inet loopback
iface eth0 inet dhcp
address 192.168.1.22
netmask 255.255.255.0
gateway 192.168.1.254

auto eth0

Network info: sudo ifconfig

VI: ESC to get into command mode. In command mode use i to insert text, ESC to get back to command mode. Get out and save by typing :wq.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • blogmarks
  • Reddit
  • Simpy
  • StumbleUpon
  • Technorati
  • DZone
  • Ma.gnolia