Common Linux commands--system info

The most important commands helping you to explore your system's information are shown in the below table.


pwd Print working directory, i.e., display the name of my current directory on the screen.
hostname Print the name of the local host (the machine on which you are working). Use netconf (as root) tochange the name of the machine
whoami Print my login name.
id username Print user id (uid) and his/her group id (gid), effective id (if different than the real id) and the supplementary groups.
date Print or change the operating system date and time. E.g., change the date and time to 2000-12-31 23:57 using this command:
date 123123572000 To set the hardware clock from the system clock, use the command (as root) setclock
time Determine the amount of time that it takes for a process to complete + other info. Don’t confuse it with date command. E.g. I can find out how long it takes to display a directory content using: time ls
who Determine the users logged on the machine.
rwho -a Determine all users logged on your network. The rwho service must be enabled for this command to run. If it isn’t, run setup as root to enable "rwho".
finger user_name System info about a user. Try: finger root
last Show listing of users last logged-in on your system.
history | more Show the last (1000 or so) commands executed from the command line on the current account. The more" causes the display to stop after each screenful.
Uptime Amount of time since last reboot.
ps (=print status) List the processes currently run by the current user.
ps ax | more List all the processes currently running, even those without the controllling 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). In KDE, you can get GUI-based Ktop from "K"menu under "System"-"Task Manager" (or by executing "ktop" in an X-terminal).
uname -a Info on your server.
free Memory info (in kilobytes).
df -h  (=disk free) Print disk info about all the filesystems (in human-readable form)
du / -bh | more (=disk usage) Print detailed disk usage for each subdirectory starting at root (in human legible form).
cat /proc/cpuinfo Cpu info. Note that the files in the /proc directory are not real files. They are hooks to look at information available to the kernel.
cat /proc/interrupts List the interrupts in use.
cat /proc/version Linux version and other info
cat /proc/filesystems Show the types of filesystems currently in use.
cat /etc/printcap Show the setup of printers.
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.
dmes | less Print kernel messages (the current contnent 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.
Posted on: 14/12/2009

If you want to leave a comment please Login or Register