10 Lesser Known Linux Commands – Part 2

Continuing the last conversation from 11 Lesser Known Useful Linux Commands – Part I here in this article we will be focusing on other lesser known Linux commands, that will prove to be very much useful in managing Desktop and Server.

Lesser Known Linux Commands
10 Lesser Known Linux Commands

12. <space> Command

Every piece of command you type in terminal gets recorded in the history and can be retried using history command.

How about cheating history command? Yeah you can do it and its very easy. Just put one or more white space before typing a command in terminal and your command wont be recorded.

Lets give it a try, we will try five common Linux commands (say ls, pwd, uname, echo “hi” and who) in terminal after one white space and check if these commands are docked in history or not.

[email protected]:~$  ls
[email protected]:~$  pwd
[email protected]:~$  uname
[email protected]:~$  echo “hi”
[email protected]:~$  who

Now run ‘history‘ command to see whether these above executed commands are recorded or not.

[email protected]:~$ history

   40  cd /dev/ 
   41  ls 
   42  dd if=/dev/cdrom1 of=/home/avi/Desktop/squeeze.iso 
   43  ping www.google.com 
   44  su

You see our last executed commands are not logged. we can also cheat history by using an alternate command ‘cat | bash‘ of-course without quotes, in the same way as above.

13. stat Command

The stat command in Linux displays the status information of a file or filesystem. The stat shows a whole lot of information about the file which name is passed as argument. Status Information includes file Size, Blocks, Access Permission, Date-time of file last access, Modify, change, etc.

[email protected]:~$ stat 34.odt 

  File: `34.odt' 
  Size: 28822     	Blocks: 64         IO Block: 4096   regular file 
Device: 801h/2049d	Inode: 5030293     Links: 1 
Access: (0644/-rw-r--r--)  Uid: ( 1000/     avi)   Gid: ( 1000/     avi) 
Access: 2013-10-14 00:17:40.000000000 +0530 
Modify: 2013-10-01 15:20:17.000000000 +0530 
Change: 2013-10-01 15:20:17.000000000 +0530

14. <alt>. and <esc>.

The above key combination is not actually a command but a tweak which put the last command argument at prompt, in the order of last entered command to previous entered command. Just press and hold ‘Alt‘ or ‘Esc‘ and continue pressing ‘.‘.

Download Linux Command Line Cheat Sheet

Download Linux Command Line Book

15. pv command

You might have seen simulating text in Movies specially Hollywood Movies, where the text appears as if it is being typed in the Real time. You can echo any kind of text and output in simulating fashion using ‘pv‘ command, as pipelined above. The pv command might not be installed in your system, and you have to apt or yum the required packages to install ‘pv‘ into your box.

[email protected]:# echo "Tecmint [dot] com is the world's best website for qualitative Linux article" | pv -qL 20
Sample Outpit
Tecmint [dot] com is the world's best website for qualitative Linux article

16. mount | column -t

The above command shows the list of all the mounted filesystem in a nice formatting with specification.

[email protected]:~$ mount | column -t
Sample Outpit
/dev/sda1    on  /                         type  ext3         (rw,errors=remount-ro) 
tmpfs        on  /lib/init/rw              type  tmpfs        (rw,nosuid,mode=0755) 
proc         on  /proc                     type  proc         (rw,noexec,nosuid,nodev) 
sysfs        on  /sys                      type  sysfs        (rw,noexec,nosuid,nodev) 
udev         on  /dev                      type  tmpfs        (rw,mode=0755) 
tmpfs        on  /dev/shm                  type  tmpfs        (rw,nosuid,nodev) 
devpts       on  /dev/pts                  type  devpts       (rw,noexec,nosuid,gid=5,mode=620) 
fusectl      on  /sys/fs/fuse/connections  type  fusectl      (rw) 
binfmt_misc  on  /proc/sys/fs/binfmt_misc  type  binfmt_misc  (rw,noexec,nosuid,nodev) 
nfsd         on  /proc/fs/nfsd             type  nfsd         (rw)

17. Ctr+l command

Before going further, let me ask you how you clear your terminal. Hmmm! You type “clear” at prompt. Well the above command perform the action of cleaning your terminal all at a once. Just press “Ctr+l” and see how it clears your terminal all at once.

18. curl command

How about checking your unread mail from the command line. This command is very useful for those who work on headless server. Again it asks for password at run time and you need not hard code your password in the above line, which is otherwise a security risk.

[email protected]:~$ curl -u [email protected] --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "\t" if //; print "$2\n" if /<(title|name)>(.*)<\/>/;'
Sample Outpit
Enter host password for user '[email protected]': 
Gmail - Inbox for [email protected] 
People offering cars in Delhi - Oct 26 
	Quikr Alerts 
another dependency question 
	Chris Bannister 
	Ralf Mardorf 
	François Patte 
Hi Avishek - Download your Free MBA Brochure Now... 
★Top Best Sellers Of The Week, Take Your Pick★ 
aptitude misconfigure? 
	Glenn English 
Choosing Debian version or derivative to run Wine when resource poor 
	Chris Bannister 
	Zenaan Harkness 
	Tom H 
	Richard Owlett 
	Ralf Mardorf 
	Rob Owens

19. screen Command

The screen command makes it possible to detach a long running process from a session that can again be reattached, as and when required which provides flexibility in command execution.

To run a process (long) we generally execute as

[email protected]:~$ ./long-unix-script.sh

Which lacks flexibility and needs the user to continue with the current session, however if we execute the above command as.

[email protected]:~$ screen ./long-unix-script.sh

It can be de-attached or re-attached in different sessions. When a command is executing press “Ctrl + A” and then “d” to de-attach. To attach run.

[email protected]:~$ screen -r 4980.pts-0.localhost

Note: Here, the later part of this command is screen id, which you can get using ‘screen -ls‘ command. To know more about ‘screen command‘ and their usage, please read our article that shows some useful 10 screen commands with examples.

20. file

No! the above command is not a typo. ‘file‘ is a command which gives you information about the type of file.

[email protected]:~$ file 34.odt 

34.odt: OpenDocument Text

21. id

The above command print real and effective user and group ids.

[email protected]:~$ id
Sample Output
uid=1000(avi) gid=1000(avi) 

That’s all for now. Seeing the success of last article of this series and this very article, I’ll be coming with another part of this article containing several other Lesser Known Linux commands very soon. Till then Stay Tuned and connected to Tecmint. Don’t Forget to provide us with your value-able Feedback in Comments.

Read Also

  1. 10 Lesser Known Commands for Linux – Part 3
  2. 10 Lesser Known Effective Linux Commands – Part IV
  3. 10 Lesser Known Useful Linux Commands- Part V
If you read this far, tweet to the author to show them you care. Tweet a thanks
Ronav Saive
A Passionate GNU/Linux Enthusiast and Software Developer with over a decade in the field of Linux and Open Source technologies.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

26 thoughts on “10 Lesser Known Linux Commands – Part 2”

    • @Arun,

      What error you getting on the screen after execution of curl command? do you share with us so that we can check and get back to you with solution. Also the curl package installed on the system?

  1. Screen is a nice tool indeed, although tmux is worth a look. The session management is far more stable imo. Thanks for showing the other commands, didn’t know all of them yet :)

    • Thanks @ Gunnar, for your feedback, sure would write an article on tmux, You can also contribute an article on tmux, if you are very much familiar with the application.

      And there exists a lot of things in/about Linux, none of us know :)


Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.