Pick a Free OS

User login

Navigation

Starters for Linux - Part 2

List all the processes currently running, even those without the controlling terminal, together with the name of the user that owns each process.

top

Keep listing the currently running processes, sorted by cpu usage (top users first).

uname -a

Info on your server.

free

Memory info (in kilobytes).

df -h

Print disk info about all the file systems in a human-readable form.

du / -bh | more

Print detailed disk usage for each subdirectory starting at root (in a human readable form).

lsmod

(as root. Use /sbin/lsmod to execute this command when you are a non-root user.) Show the kernel modules currently loaded.

set|more

Show the current user environment.

echo $PATH

Show the content of the environment variable PATH. This command can be used to show other environment variables as well. Use set to see the full environment.

dmesg | less

Print kernel messages (the current content of the so-called kernel ring buffer). Press q to quit less. Use less /var/log/dmesg to see what dmesg dumped into the file right after bootup.

Commands for Process control

ps

Display the list of currently running processes with their process IDs (PID) numbers. Use ps aux to see all processes currently running on your system (also those of other users or without a controlling terminal),

each with the name of the owner. Use top to keep listing the processes currently running.

fg

PID Bring a background or stopped process to the foreground.

bg

PID Send the process to the background. This is the opposite of fg. The same can be accomplished with Ctrl z

any_command &

Run any command in the background (the symbol ‘&’ means run the command in the background?).

kill PID

Force a process shutdown. First determine the PID of the process to kill using ps.

killall -9 program_name

Kill program(s) by name.

xkill

(in an xwindow terminal) Kill a GUI-based program with mouse. (Point with your mouse cursor at the window of the process you want to kill and click.)

lpc

(as root) Check and control the printer(s). Type ??? to see the list of available commands.

lpq

Show the content of the printer queue.

lprm job_number

Remove a printing job job_number from the queue.

nice program_name