A Collection of Best linux Commands

17Mar09

These are some of the best Linux commands that I have found from internet and used them personally. I’ll update the list as I get more useful commands.

hostname

Prints the name of the local host that you are currently working on. Use netconf to change the name of the machine.

whoami

This prints your login name on the screen. This can be extremely useful if you switch between a user and root.

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., I could change the date and time to 2000-12-31 23:57 using this command:
date 123123572000
To set the hardware (BIOS) clock from the system (Linux) clock, use the command (as root) setclock <- Do not use this for evil.

time
Determine the amount of time that it takes for a process to complete + other info. Don’t confuse it with the date command. E.g. I can find out how long it takes to display a directory content using:
time ls

I used this command all the time in University. It’s really useful for checking to see how efficient your algorithms are.

who
Determine the users logged on the machine.

rwho -a
(=remote who) 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

Believe me, as an administrator, you will use this one all of the time.

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.

Not only can you press the up button, but you can list the history in this manner. This is extremely useful, if you have to type in complicated commands that require long directory listings.

uptime
Show the amount of time since the last reboot.

ps
(=print status) List the processes currently run by the current user.

This is like the task manager for windows, but more ghetto. Although, you do have more control.

ps axu | more
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). 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
(= Unix name with option “all”) Info on your (local) server. I can also use guname (in X-window terminal) to display the info more nicely.

free
Memory info (in kilobytes).

df -h
(=disk free) Print disk info about all the filesystems (in human-readable form)

This command is so useful. I found it really difficult to tell in my linux systems how much memory I had left. This was a life saver.

du / -bh | more
(=disk usage) Print detailed disk usage for each subdirectory starting at the “/” (root) directory (in human legible form).

cat /proc/cpuinfo
Cpu info-it show the content of the file cpuinfo. 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.

Very useful if you are updating or recompiling your kernel.

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.

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.

Reference

http://web2linux.blogspot.com/2007/09/top-25-linux-commands.html



3 Responses to “A Collection of Best linux Commands”

  1. Great article, thanks for the information.

  2. 3 dehes

    hi all..
    how can i retrive power supply and fan info from linux command??

    can u give me the command to see the power supplies and fan info..
    pls help me..
    u can reply to my e-mail address..

    thanks..


Leave a reply to meter down Cancel reply