Useful Linux Commands

Every now and then I come across some really useful Linux command that I’m worried that I might forget about unless I write it down somewhere. That somewhere is here!

Show all rpm packages installed

rpm -qa | more

Install an rpm package

rpm -i packagename.rpm

Show all running processes

ps waux


ps -A

Find out if a particular process is running
for example, find out if httpd is running….

ben@ubuntu:~$ ps -C httpd
  PID TTY          TIME CMD
 5491 ?        00:00:00 httpd
 5500 ?        00:00:00 httpd
 5520 ?        00:00:00 httpd
 5521 ?        00:00:00 httpd
 5522 ?        00:00:00 httpd
 5523 ?        00:00:00 httpd
 5526 ?        00:00:00 httpd

Force quit a process or application that has stopped responding

kill -9 processID

How to find out which version (distro) of Linux you are running

cat /etc/*-release

Disk Usage (du)

display directory size

du -hx <source directory>

display directory size without subdirectories…

du -hsx <source directory>

list directory sizes of all directories in the current level – this is the most useful one really.

du -hsx *

Move a site over FTP without archiving first

wget -r --mirror --ftp-user=username --ftp-password=password*

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>