What is Linux? 🔍
Linux is a Unix-like, open source and community-developed operating system (OS) for computers, servers, mainframes, mobile devices and embedded devices. It is supported on almost every major computer platform, including x86, ARM and SPARC, making it one of the most widely supported operating systems.
How is the Linux operating system used?
Every version of the Linux OS manages hardware resources, launches and handles applications, and provides some form of user interface. The enormous community for developers and wide range of distributions means that a Linux version is available for almost any task, and Linux has penetrated many areas of computing.
For example, Linux has emerged as a popular OS for web servers such as Apache, as well as for network operations, scientific computing tasks that require huge compute clusters, running databases, desktop and endpoint computing, and running mobile devices with OS versions like Android.
Linux is highly configurable and depends on a modular design that enables users to customize their own versions of Linux. Depending on the application, Linux can be optimized for different purposes such as:
- Networking performance
- Computation performance
- Deployment on specific hardware platforms &
- Deployment on systems with limited memory, storage or computing resources.
Users can choose different Linux distributions for specific applications or adapt a specific distribution to incorporate custom kernel configurations.
Now comes the main part, Here are 10 Linux command to get started into Linux based distros & rapidly increase productivity.
- free —
get free and used memory
Are you running out of memory? Use the free command to show the total amount of free and used physical (RAM) and swap memory in the Linux system. It also displays the buffers and caches used by the kernel:
1free2# human readable outputs3free -h4# use the cat command to find geeky details5cat /proc/meminfo
However, the free command will not give information about memory configurations, maximum supported memory by the Linux server, and Linux memory speed. Hence, we must use the dmidecode command:
1sudo dmidecode -t memory
Want to determine the amount of video memory under Linux, try:
1lspci | grep -i vga2glxinfo | egrep -i 'device|memory'
- hwinfo –
probe for hardware
We can quickly probe for the hardware present in the Linux server or desktop:
1# Find detailed info about the Linux box2hwinfo3# Show only a summary #4hwinfo --short5# View all disks #6hwinfo --disk7# Get an overview #8hwinfo --short --block9# Find a particular disk #10hwinfo --disk --only /dev/sda11hwinfo --disk --only /dev/sda12# Try 4 graphics card ports for monitor data #13hwprobe=bios.ddc.ports=4 hwinfo --monitor14# Limit info to specific devices #15hwinfo --short --cpu --disk --listmd --gfxcard --wlan --printer
Alternatively, you may find the lshw command and inxi command useful to display your Linux hardware information:
1sudo lshw -short2inxi -Fxz
Here, “inxi” is system information tool to get system configurations and hardware. It shows system hardware, CPU, drivers, Xorg, Desktop, Kernel, gcc version(s), Processes, RAM usage, and a wide variety of other useful information.
- id –
know yourself
Display Linux user and group information for the given USER name. If user name omitted show information for the current user:
1id
See who is logged on your Linux server:
1who2who am i
- lsblk –
list block storage devices
All Linux block devices give buffered access to hardware devices and allow reading and writing blocks as per configuration. Linux block device has names. For example, /dev/nvme0n1 for NVMe and /dev/sda for SCSI devices such as HDD/SSD. But you don’t have to remember them, you can list them easily using the following syntax:
1lsblk2# list only #3lsblk -l4# filter out loop devices using the grep command #5lsblk -l | grep '^loop'
1NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT2md0 9:0 0 3.7G 0 raid1 /boot3md1 9:1 0 949.1G 0 raid14md1_crypt 253:0 0 949.1G 0 crypt5nixcraft-swap 253:1 0 119.2G 0 lvm [SWAP]6nixcraft-root 253:2 0 829.9G 0 lvm /7nvme1n1 259:0 0 953.9G 0 disk8nvme1n1p1 259:1 0 953M 0 part9nvme1n1p2 259:2 0 3.7G 0 part10nvme1n1p3 259:3 0 949.2G 0 part11nvme0n1 259:4 0 953.9G 0 disk12nvme0n1p1 259:5 0 953M 0 part /boot/efi13nvme0n1p2 259:6 0 3.7G 0 part14nvme0n1p3 259:7 0 949.2G 0 part
- lsb_release –
Linux distribution information
Want to get distribution-specific information such as, description of the currently installed distribution, release number and code name:
1lsb_release -a
No LSB modules are available.
1Distributor ID: Ubuntu2Description: Ubuntu 20.04.1 LTS3Release: 20.044Codename: focal
- lscpu –
display info about the CPUs
The “lscpu” command gathers and displays CPU architecture information in an easy-to-read format for humans including various CPU bugs:
1lscpu
1Architecture: x86_642CPU op-mode(s): 32-bit, 64-bit3CPU(s): 84On-line CPU(s) list: 0-75Thread(s) per core: 26Core(s) per socket: 47. .8. .9. .10more...
Cpu can be listed using the lshw command too:
1sudo lshw -C cpu
- lstopo –
display hardware topology
Want to see the topology of the Linux server or desktop? (This is one of my fav), try here :
1lstopo2lstopo-no-graphics
You will see information about:
• NUMA memory nodes, shared caches, CPU packages, processor cores, processorthread & more…
- A. lsusb –
list usb devices
We all use USB devices, such as external hard drives and keyboards. Run the *“lsusb"" command for displaying information about USB buses in the Linux system and the devices connected to them.
1lsusb2# Want a graphical summary of USB devices connected to the system? #3sudo usbview
- B. lspci –
list PCI devices
We use the “lspci” command for displaying information about PCI buses in the system and devices connected to them:
1lspci
- timedatectl –
show current date and time zone
Typically we use the date command to set or get date/time information on the CLI:
1date
However, modern Linux distro use the “timedatectl"" command to query and change the system clock and its settings, and enable or disable time synchronization services (NTPD and co):
1timedatectl
1Local time: Sun 2020-12-08 15:42:16 IST2 Universal time: Sun 2020-12-08 10:12:16 UTC3 RTC time: Sun 2020-12-08 10:12:164 Time zone: Asia/Kolkata (IST, +0530)5 System clock synchronized: yes6 NTP service: active7 RTC in local TZ: no
- w –
who is logged in
Run the w command on Linux to see information about the Linux users currently on the machine, and their processes:
1$ w
Conclusion
There are many Linux commands that can be used to get information about the Linux server or desktop. I’ve only listed the most important ones. Go ahead and try them out.
That is all, I hope you liked the post. Thank you very much for reading, and have a great day! 😄