More Linux Commands. Very useful to know for a Linux user.

Posted: January 2, 2011. At: 8:32 AM. This was 7 years ago. Post ID: 821
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.

While running Linux, if you want to list the contents of a folder in a vertical list format, just use the ls command with these switches.

ls -hula --color=auto

then you get the directory listing with human readable file sizes instead of being listed in bytes.

To list the partitions on a disk, just type this command.

fdisk -l /dev/sdb

for example and it will list the partitions on the device. You need superuser priviledges to run this command. Then you get the output below.

linux-3d5u:/home/shoggoth # fdisk -l /dev/sdb
Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bd059
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        7858    63118336   83  Linux
/dev/sdb2            7859       19457    93168937    5  Extended
/dev/sdb5            7859       15580    62026933+  83  Linux
/dev/sdb6           15581       17228    13237528+  83  Linux
/dev/sdb7           17229       19083    14900256   83  Linux
/dev/sdb8           19084       19457     3004123+  82  Linux swap / Solaris

A very useful command. This is useful when I am double checking which partition to install Linux to on my hard drive so I do not overwrite the wrong partition.

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

Leave a Reply