Simple Linux commands to get information about your system.

Posted: September 19, 2015. At: 2:23 PM. This was 2 years ago. Post ID: 8375
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

This simple command will print the remaining free space on your hard disk.

[email protected]:~# df -Hla
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       32G  9.6G   21G  32% /
proc               0     0     0    - /proc
sysfs              0     0     0    - /sys
none            4.1k     0  4.1k   0% /sys/fs/cgroup
none               0     0     0    - /sys/fs/fuse/connections
none               0     0     0    - /sys/kernel/debug
none               0     0     0    - /sys/kernel/security
udev            516M   13k  516M   1% /dev
devpts             0     0     0    - /dev/pts
tmpfs           105M  365k  104M   1% /run
none            5.3M     0  5.3M   0% /run/lock
none            521M     0  521M   0% /run/shm
none            105M     0  105M   0% /run/user
none               0     0     0    - /sys/fs/pstore
systemd            0     0     0    - /sys/fs/cgroup/systemd
[email protected]:~#

Print the total size taken up by a folder.

ubuntu ~ $ du -ackh 2> /dev/null | tail -n 1
490M    total

Get more information about memory and CPU usage.

ubuntu ~/Documents $ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 5  0      0  97884  82632 167448    0    0     1     2   14   11  0  0 100  0  0

List the swap partitions on your Linux machine. If you have one that is.

root@ip-172-31-20-16:/home/ubuntu/Documents# swapon -s -v
Filename                                Type            Size    Used    Priority

List partitions on a disk. You just need to specify the disk device name. This will also print a lot of information about the disk partition.

root@ip-172-31-20-16:/home/ubuntu/Documents# fdisk -l /dev/xvda
 
Disk /dev/xvda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders, total 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
 
    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *       16065    62910539    31447237+  83  Linux

Print out a list of hardware installed in your Linux machine. The lspci command will be very helpful when troubleshooting a problem.

[email protected]:~# lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 01)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)

This is another way to print the block devices or disks attached to your Linux machine.

[email protected]:~# lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  30G  0 disk
└─xvda1 202:1    0  30G  0 part /

No comments have been made. Use this form to start the conversation :)

Leave a Reply