• SoniaSamipillai

Linux Command line Essentials - CheatSheet1- Know your system

If you would like to know some quick facts about your system, the following commands can be helpful. List of commands discussed are listed here.


1. df

2. df -h

3. uptime

4. whoami

5. hostname

6. uname

7. lshw

8. lscpu


1. df

shows all the disc space allocated and how much you are using out of it.


2. df -h

shows the above info in a human readable way. Notice these large numbers reported in the columns next to Filesystem and see how its human friendly when you use -h option.


3. uptime

shows uptime of the system. How many hours the system has been up? load average shows three different averages. The load average represents the average system load over a period of time. It conventionally appears in the form of three numbers which represent the system load during the last one-, five-, and fifteen-minute periods.


4. whoami

This is your current username. showing the name of the current host. one can use --help on all the commands to get details on their usage.

whoami --help

whoami --help | less

Less is a pager, which allows us to see the output of the command page by page. I could use arrow keys or the space bar to scroll down and in less, you can even scroll up. use keys hjkl to navigate. click q to exit when you are done reading.

whoami --version shows the current version of the utility.


5. hostname

shows me the current name of this host.

--all-ip-addresses shows all ip addresses currently in use by this host


6. uname

shows the name of operating system

Uname is an interesting command because it's going to give you some information about your system, about a kernel, in particular. And you can see information such as kernel version, and kernel build, and platform.

uname -a

says all about the os

uname -s command will print the kernel name of your system.

To view your network hostname, use ‘-n’ switch with uname command as shown.To get information about kernel-version, use ‘-v’ switch.


7. Date

shows the current date and time.The date command allows you to show current date and time. And you can even use it to set the current date and time. Notice that this is not only the date and time, but also the current time zone, PST, and the year as well.


8. lshw tool

Shows information about your hardware components such as cpu, disks, memory, usb controllers and so on. Do remember that the lshw command executed by superuser (root) or sudo user.You can print a summary of your hardware information by using the -short option.


9. lscpu

To view information about your CPU, use the --e for extended option and it shows information about your CPU architecture such as number of CPU’s, cores, CPU family model, CPU caches, threads and so on.If you want to view all block devices on your system then include the -a option like shown below.


10. last

The last command is going to show you a list of users that have logged into your system last

.

After you practice the above commands, use ctrl+l to clear the screen. we will revise another set of commands in the next blog.


8 views0 comments