in

Useless Linux Terminal Commands

- - 39 comments
Not long ago, I have listed here some useful Linux terminal commands and those that I described as deadly. This time, I decided to gather some commands that I think have no practical use. I know it sounds interesting but you may disagree with me on some of the commands that I'll list here as you may find a few of them useful. We can however agree to disagree as long as you explain to us why or how you find them handy.

So without any more delay, here are several useless Linux terminal commands:


clear command

The clear command simply clears the terminal screen. I don't find it useful since hitting CTRL-L is the quickest way of clearing the terminal screen.


rev command

The rev command as described on its man page is a utility that copies the specified files to the standard output, reversing the order of characters in every line. If no files are specified, the standard input is read.

As an example, I typed the sentence “Linux is fun” after the rev command, and here's the result:

$ rev
Linux is fun
nuf si xuniL

I've heard that rev has been used a long time ago in translating from or to languages that can be read from right to left. But now that the modern terminals can be set to display different languages correctly, I think rev has no practical use.


vdir command

The vdir command has the same output as the commonly used ls -lb. It lists the directory contents in alphabetical order along with information about the files. See the following examples:

$ vdir
total 60424
-rw-r--r-- 1 jun jun 111295 2009-07-20 22:46 img_0001.png
-rw-r--r-- 1 jun jun 384081 2009-07-20 22:45 img_0011.jpg
-rw-r--r-- 1 jun jun 451303 2009-07-20 22:45 img_0013.jpg
-rw-r--r-- 1 jun jun 468926 2009-07-20 22:45 img_0017.jpg
-rw-r--r-- 1 jun jun 443045 2009-07-20 22:45 img_0019.jpg

$ ls -lb
total 60424
-rw-r--r-- 1 jun jun 111295 2009-07-20 22:46 img_0001.png
-rw-r--r-- 1 jun jun 384081 2009-07-20 22:45 img_0011.jpg
-rw-r--r-- 1 jun jun 451303 2009-07-20 22:45 img_0013.jpg
-rw-r--r-- 1 jun jun 468926 2009-07-20 22:45 img_0017.jpg
-rw-r--r-- 1 jun jun 443045 2009-07-20 22:45 img_0019.jpg


ul command

Description from the man page: The ul utility reads the named files (or standard input if none are given) and translates occurrences of underscores to the sequence that indicates underlining for the terminal in use, as specified by the environment variable TERM.


$ cat hello.txt
hello_world

$ ul hello.txt
hello_world

The output is the same as using the cat command. "ul" was utilized back then on making underlined text readable, but at present I think it has become useless.


If you have other useless commands to add, please share them with us via comment.

39 comments

  1. ctrl+L doesn't always work to clear the screen.
    "clear" is the only way (that I know of) to clear the screen in a RHEL5 rescue environment for example.

    ReplyDelete
  2. How about the 'exit' command?
    Does anybody use it instead of Ctrl-D to exit su or the terminal?

    ReplyDelete
  3. How about LS ?

    ReplyDelete
  4. cd is useless

    ReplyDelete
  5. Control-D can be disastrous to have as exit from a terminal. What if you accidentally hit cntl-d twice by accident to end output and then it kicks you out? I trap for CNTL-D for ending a shell and make it only exit...

    ReplyDelete
  6. Well I use exit.

    ReplyDelete
  7. agreed, haha, cd is about as useful as su, I say we ditch 'em both

    ReplyDelete
  8. exit is still used. Take, for example, a jailbroken iPhone. There is no ctrl key, so you need to type exit.

    ReplyDelete
  9. I frequently use clear when I'm compiling and expect a large number of warnings and errors... It can be hard to find where the warnings for the last time I compiled stop and the warnings for the current compile start, so instead of
    >> make
    I run
    >> clear;clear;make

    so it puts a nice block of blank above the current compile output and its easy to see what I need to fix. Having this command in my history also makes it quicker to call up than hitting Ctrl-l twice then running make

    ReplyDelete
  10. You need "clear" in scripts.

    ReplyDelete
  11. clear, exit, etc. are all used in scripts, please don't forget that the unix command interpreters don't know / and or care if you are interactive or a batch job. It is much more human readable to type clear, or exit, than it is to do a ctl-v L, or ctl-v D in a script. That being said, I have always been annoyed with ROT13.

    ReplyDelete
  12. it's difference ctrl+l ls or clear;ls

    ReplyDelete
  13. ctrl+l ls or clear;ls ---> i preffer clear;ls

    ReplyDelete
  14. Ctrl-L only works for readline applications, not for others. So if one's shell is not coded with readline, he/she has to use 'clear'

    ReplyDelete
  15. Hey other Anonymous, I always use "exit", never ctrl-d to close my terminal. In fact, I can't exit with ctrl-d because I have "set -o ignoreeof" in my ~/.bashrc.

    Why? Because I use ctrl-d to exit various subshells that I use, e.g. from within vi etc, but I don't want my session to close just because I think I am in a sub-shell and I ctrl-d. I would rather require an explicit "exit" to indicate that I am logging completely off.

    ReplyDelete
  16. ls may be (parially) replace by echo:
    Try this:
    ls *
    echo *

    ReplyDelete
  17. Can you put ctrl+L in a shell script?

    @Carl: Ditto for ctrl+D

    @Anonymous: yes is occasionally useful for getting past insecure futilities that need constant affirmation.

    ReplyDelete
  18. neither "clear" nor "exit" (@carl) are useless.
    Commands are not for interactive use only, they are also used in scripts. And in a script there is nobody to press CTRL-L for you to clear the screen and start on a clear "page" again.
    Same goes for exit, you need it to exit the scripts at various points (ex exit if some error occured that prevents the script to properly continue the operations). Also, you return an exit code using the same "exit".

    ReplyDelete
  19. Here's an example usage of rev:

    find . -type f | while read F; do echo $(basename "$F" | rev)/$F; done | sort | cut -f2- -d/

    It lists files sorted by their reverse filename. Useful if you want to group files by their extension before sending them to tar for example.

    And as others have already said, clear is very useful in scripts. On the command line I usually use command[Ctrl-L][Enter], for example $ du -hs *[Ctrl-L][Enter]

    ReplyDelete
  20. I use vdir quiet often coz it I can type it using the 26 alphet keys, faster for few min-secounds and needn't to setup alias in every GNU/Linux box I used.

    ReplyDelete
  21. well try ddate if you want a useless command .

    /* aint telling what it does, its a surprise */

    ReplyDelete
  22. I think linux should not use a lot of terminal command although it was powerful. Less command on terminal and switch to GUI is more better. I think this is why linux cannot still cannot compare to Mac or Windows. Just my opinion.

    ReplyDelete
  23. That ddate made me lol, fellow anon.

    ReplyDelete
  24. ul works by appending a backspace for each underscore:

    echo -e '____\b\b\b\btest' | ul

    ReplyDelete
  25. CTRL + L wont work in all terminals; in that case need clear

    ReplyDelete
  26. Silly Anonymous,

    The reason for a GUI is to have more terminals :)

    ReplyDelete
  27. I use both "clear" and "exit" instead of Ctrl stuff.
    Not to say about shell scripts...

    ReplyDelete
  28. Other useless commands: banner(6), fortune(6)

    ReplyDelete
  29. Use screen and have all the terminals you want..

    ReplyDelete
  30. Control-L does not work on all terminals. The clear command uses terminfo or termcap (depending on the UNIX environment) to clear the screen. clear works with any terminal that
    is in the terminal database, but control-L only works on a very small subset.


    rev is often used to as a way of processing the end of a line first for sorting and such (ex. finding rhyming words, sorting by extention).


    vdir does indeed provide duplicate functionality. So, it is purely a preference.


    ul removes "underline" control characters, not underscore characters. The difference is that an underscore is a ASCII character (0x5F), while underscore control characters are teminal
    specific depending on the terminal type. The point of this that when printing documents that
    have embedded control sequences removing the control sequences can lead to much nicer looking
    output. Historically, this sort of thing was the result of processing a document through nroff. The command col does a very similar thing.


    Because, you do not use a command does not make it useless. It was probably useful to those who
    created it. And if you lack understanding of ttys and such, it would be best to not pontificate about what is and is not useful.

    Troy

    ReplyDelete
  31. clear is useful to clear the screen in a bash script. Otherwise you would have to include a ^L character in the middle of the script. Not the best approach in my opinion.

    Similarly, exit can be used to exit from a script.

    ReplyDelete
  32. The clear command is there for use in shell scripts. For instance, users may put this command into their .bash_logout file to ensure that the screen is cleared when they logout. Hitting Ctrl-L in a script doesn't work.

    ReplyDelete
  33. Amen. Troy!

    ReplyDelete
  34. ddate ha ha

    didn't know today was Prickle-Prickle

    ReplyDelete
  35. Fortune (and ddate, for that matter) is not useless. One can get much amusement and insight from that command.

    ReplyDelete
  36. Thanks for introducing me to ddate :)

    ReplyDelete
  37. I find those as useless commands:

    $ eject ( to don't need to find such a little button to eject your cd's/dvd's )

    $ lshw ( to know almost everything about your hardware )

    $ shutdown -h -minutes- ( to power off your computer when you want )

    $ nmap -sS -v -v -ip adress- ( after install it, know witch ports are open;) )

    $ aircrack-ptw *.cap ( after install it, deencrypt wireless key with half packages than aircrack-ng )

    $ fsck -vf /dev/hda1 ( change hda1 for your hard drive and realize that in Linux is almost no disk fragmentation )

    And of course:

    $ man -software- ( this one is the "holy bible" )

    Cheers, have a nice day.

    Alfons.

    ReplyDelete
  38. many of the key board short cuts were not supported in earlier unix.....and the keyboard short cuts are implemented using these commands

    ReplyDelete
  39. Banner is one of them. Other one I can think of is 'nl'

    unstableme.blogspot.com

    ReplyDelete