10 Lesser Known Linux Commands – Part 2

Following up on our previous discussion of lesser-known Linux commands, this article will explore more hidden commands, which are extremely useful for managing your Linux system from the command line.

12. <space> Command – Hiding Commands from Linux History

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

How about cheating history command? Yeah, you can do it, and it is very easy. Just put one or more white space before typing a command in the terminal and your command won’t be recorded.

Let’s give it a try. We will enter five common Linux commands (ls, pwd, uname, echo, and who) in the terminal with a leading space and check if these commands are logged in the history or not.

ls
pwd
uname
echo “hi”
who

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

history

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.

Hide Commands in Linux History
Hide Commands in Linux History

13. stat Command – Show File Status Information

The stat command in Linux displays the status information of a file or filesystem. The `stat` command shows a lot of information about the file whose name is passed as an argument.

Status information includes file size, blocks, access permissions, and the date and time of the last access, modification, and change.

stat lists.txt
Show File Status Information
Show File Status Information

14. Using <Alt> + . and <Esc> + . to Recall Last Command Arguments

The above key combination is not actually a command but a tweak that puts the last command argument at the prompt, in the order of the last entered command to the previous entered command.

Just press and hold Alt or Esc and continue pressing…

If your last command was:

ls /home/user/documents

Pressing Alt + . or Esc + . in the terminal will insert /home/user/documents at the prompt.

15. Simulating Text with the pv Command

You might have seen text being simulated in movies, especially Hollywood movies, where it appears as if it is being typed in real-time. You can simulate any kind of text and output in this fashion using the pv command, as shown in the example above.

The pv command might not be installed on your system, and you may need to use your package manager to install the required packages.

sudo apt install pv         [On Debian, Ubuntu and Mint]
sudo yum install pv         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
sudo emerge -a sys-apps/pv  [On Gentoo Linux]
sudo apk add pv             [On Alpine Linux]
sudo pacman -S pv           [On Arch Linux]
sudo zypper install pv      [On OpenSUSE]    
sudo pkg install pv         [On FreeBSD]

Now you can use pv in combination with echo to simulate the typing of a message. Here, -q suppresses the progress bar and -L 20 sets the typing speed to 20 bytes per second.

echo "Tecmint [dot] com is the world's best website for qualitative Linux article" | pv -qL 20
Simulating Text in Terminal
Simulating Text in Terminal

16. Formatting Mounted Filesystems with mount and column

The command mount | column -t displays a list of all mounted filesystems in a neatly formatted table.

mount | column -t

This will show the list of mounted filesystems in a clean, organized format with columns properly aligned, making it easier to read and interpret the output.

Show Mounted Filesystems in Table Format
Show Mounted Filesystems in Table Format

17. Clearing Your Terminal with Ctrl+L Command

Before we proceed, let me ask you how you clear your terminal. Do you type clear at the prompt? Well, the Ctrl+L keyboard shortcut performs the same action of clearing your terminal all at once.

Just press Ctrl+L and watch how it clears your terminal instantly.

18. Checking Unread Mail with curl Command

The curl command can be used to check your unread mail from the command line, which is especially useful for those working on headless servers.

Note that storing your password in the command line directly is not recommended. Instead, curl will prompt you for your password securely.

curl -u username:password https://mail.example.com/api/unread

In the above command, replace username, and password and adjust the URL to match your mail server’s API endpoint.

19. Using ‘screen’ to Manage Long-Running Processes

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 it as:

long_running_command

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

screen long_running_command

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.

screen -r 4980.pts-0.localhost

Note: Here, the later part of this command is screen id, which you can get using the ‘screen -ls‘ command.

20. Identify File Types Using file Command

The file command is used to determine the type of a file by examining its contents rather than its name or extension.

It analyzes the file’s content and provides a description of its type.

file lists.txt

lists.txt: ASCII text

21. Find User and Group ID’s

The id command displays information about the current user or a specified user, including their user ID (UID), group ID (GID), and group memberships.

id
Show User and Group IDs
Show User and Group IDs
Conclusion

That’s all for now. With the success of this article and the previous ones in the series, I hope you’ve enjoyed exploring these lesser known Linux commands. Stay tuned for more insightful content.

In the meantime, you might find these articles interesting:

Don’t forget to share your valuable feedback in the comments!

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack 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 Comments

Leave a Reply
    • @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?

      Reply
  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 :)

    Reply
    • 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 :)

      Reply
    • @ Admin (dont know what’s your Real name) Thanks for your valueable feedback.

      comment of such kind makes us feel “Awesome” (Specially me, as a writer.)

      Reply
  2. Thanks for these…although some of them didn’t work…is it because I’m using Fedora Linux?…or is there something I need to type before the prompt?….should I be running these as root…or do I have to do the “sudo” thing before typing them?….thanks anyway!!

    Reply
    • @ Eddie G. please let us know which commands didn’t work for you so that we resolve your issue, in details please.

      Also make sure your shell is BASH.

      Reply
  3. “12” is not a command, it’s a non-default feature of the shell, which I’m assuming is bash here. Look for the HISTCONTROL variable in the bash reference manual.

    Reply
  4. For “12. Command” isn’t really cheating the history command and is likely due to either the HISTCONTROL variable being set to “ignorespace” or setting HISTIGNORE to include white space with the bash shell.

    -denver

    Reply
  5. screen is nice, but I left it behind for tmux.
    See: http://tmux.sourceforge.net/
    which I find a bit easier to use.

    Both permit remote pairing in a shared session.
    Both are complex and featureful.

    Pragmattic Programmer offers an excellent book:
    http://pragprog.com/book/bhtmux/tmux

    Well worth even a minimal investment in its learning curve.
    And the more time I spend with that book
    (which I still have not read cover-to-cover)
    the more I get out of it.

    — Hugh

    Reply
  6. No love for the ‘type’ command? If you want to know where a command is in the system, or if it’s an internal command, use ‘type’ and the name of the command:
    type bash
    or
    type help
    It will show you where the command resides. It is similar to the ‘whereis’ command that finds files as well (but shows any files that contain the name:
    whereis bash
    whereis fdisk

    Just my two cents……

    Reply
  7. Thanks for sharing. file command also use for check binary file 32 bit or 64 bit. Please let me know how to use “column” command.

    Reply
    • Welcome @ Prasad.

      well were not we very clear with above commands specially ‘column’ command. Please read the column command description above as well as man page, and let us know where we could help you.

      Reply
  8. Thx a ton…

    sudo !! : were re-typing in agony :) before
    shuf : were using ‘sort -R |head -n1’
    mount | column -t : looked like a pile of ..it before
    history cheat : didn’t work; don’t know why. happy with HISTFILE=/dev/null

    Reply
    • Welcome @ Rony B Chandran.

      will you please, provide us with details of input/output of the command not working on your box, so that we could understand it better.

      Reply
      • sparc@sputnik ~ $ uname
        Linux
        sparc@sputnik ~ $ date
        Fri Nov 1 16:06:48 IST 2013
        sparc@sputnik ~ $ echo eee
        eee
        sparc@sputnik ~ $ history
        1 top
        2 ps -ef
        3 ls -lh
        4 uname
        5 date
        6 echo eee
        7 history
        sparc@sputnik ~ $

        Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.