Some more obscure Linux commands that are very useful.

The logsave command will print the output of a command to a file. This will also add a timestamp to the logfile telling the system administrator when the command was run.

logsave /var/log/partsize df –h

This is an example, the output of the command is also printed to STDOUT.

[email protected]:~$ logsave partsize /bin/df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        19G  5.0G   13G  29% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            984M  4.0K  984M   1% /dev
tmpfs           199M  1.1M  198M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            995M   72K  995M   1% /run/shm
none            100M   24K  100M   1% /run/user

ldd. List all of the library dependencies required by a certain executable.

[email protected]:~$ ldd /bin/ls
	linux-vdso.so.1 =>  (0x00007ffd7bddc000)
	libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f961ba59000)
	libacl.so.1 => /lib/x86_64-linux-gnu/libacl.so.1 (0x00007f961b851000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f961b48c000)
	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f961b24e000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f961b04a000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f961bc7c000)
	libattr.so.1 => /lib/x86_64-linux-gnu/libattr.so.1 (0x00007f961ae45000)

lsblk. List all block devices/partitions on the system.

[email protected]:~$ lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0    20G  0 disk 
├─sda1   8:1    0    19G  0 part /
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0  1022M  0 part [SWAP]
sr0     11:0    1  1024M  0 rom

rev. This command will simply reverse all input. Here is an example.

[email protected]:~$ date | rev
5102 TSP 02:93:71 7  ceD noM

Another example.

[email protected]:~$ echo "Another Example" | rev
elpmaxE rehtonA

Even more obscure and useful Linux commands: http://www.securitronlinux.com/bejiitaswrath/some-obscure-but-very-useful-linux-commands-for-any-user/.

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

Leave a Reply