Posted: . At: 5:24 PM. This was 2 years ago. Post ID: 4638
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.


Some even more useful Linux commands and tricks for the Linux command-line user.


Some interesting and useful Linux shell commands

Large hard disk platter cassette.
Large hard disk platter cassette. These were seen in Terminator 2.

Linux has some very useful and interesting commands available to the Linux desktop user to find out information about your computer system. Some of these hearken back to the days of the old Linux terminals; when you accessed your computer from a dumb terminal instead of a graphical desktop.

The tset command will print information about the terminal type to the command prompt. Just run the tset -r command.

This is an example of the output in mate-terminal.

┌──[jason@11000000.10101000.00000001.00000011][~]
└──╼  ╼ $ tset -r
Terminal type is xterm-256color.

Run the tty command to find out the device name of the terminal you are using, e.g /dev/pts/0 this is also quite useful.

This is an example of the usage of this command.

┌──[jason@11000000.10101000.00000001.00000011][~]
└──╼  ╼ $ echo "hello world" > `tty`
hello world

Another useful command is the wall command; this will send a broadcast message to all other users on that machine. Use it like this: echo "Hello World" | wall. This is similar to the broadcast message sent out by the system when you are shutting down the computer.

If you wish to find out the characteristics of your Linux terminal or virtual console; the telltc command will be perfectly suited to this task.

This is a built-in command that works with the tcsh shell for Linux and UNIX. Below is an example. This command displays information about the number of columns and lines as well as the escape characters supported by the terminal. This is a very useful Linux command for finding out information about your terminal.

darknet:~> telltc
 
	Tcsh thinks your terminal has the
	following characteristics:
 
	It has 168 columns and 47 lines
	It has a meta key
	It can not use tabs
	It has automatic margins
	It has magic margins
	                     send cursor end (@7) == ^[OF
	                  add new blank line (al) == ^[[L
	                        audible bell (bl) == ^G
	                     clear to bottom (cd) == ^[[J
	                clear to end of line (ce) == ^[[K
	                 cursor to horiz pos (ch) == ^[[%i%p1%dG
	                        clear screen (cl) == ^[[H^[[2J
	                  delete a character (dc) == ^[[P
	                       delete a line (dl) == ^[[M
	                   start delete mode (dm) == (empty)
	                     end delete mode (ed) == (empty)
	                     end insert mode (ei) == ^[[4l
	             cursor from status line (fs) == (empty)
	                         home cursor (ho) == ^[[H
	                    insert character (ic) == (empty)
	                   start insert mode (im) == ^[[4h
	                      insert padding (ip) == (empty)
	                   sends cursor down (kd) == ^[OB
	                    send cursor home (kh) == ^[OH
	                   sends cursor left (kl) == ^[OD
	                  sends cursor right (kr) == ^[OC
	                     sends cursor up (ku) == ^[OA
	                          begin bold (md) == ^[[1m
	                      end attributes (me) == ^[[0m
	                 begin reverse video (mr) == ^[[7m
	               non destructive space (nd) == ^[[C
	                        end standout (se) == ^[[27m
	                      begin standout (so) == ^[[7m
	               cursor to status line (ts) == (empty)
	                       cursor up one (up) == ^[[A
	                     begin underline (us) == ^[[4m
	                       end underline (ue) == ^[[24m
	                        visible bell (vb) == ^[[?5h$<100/>^[[?5l
	               delete multiple chars (DC) == ^[[%p1%dP
	                cursor down multiple (DO) == ^[[%p1%dB
	               insert multiple chars (IC) == ^[[%p1%d@
	                cursor left multiple (LE) == ^[[%p1%dD
	               cursor right multiple (RI) == ^[[%p1%dC
	                  cursor up multiple (UP) == ^[[%p1%dA

To display a random fortune in Cockney slang; firstly install the fortune and filters packages.

jason@darknet:~$ sudo apt-get install fortune filters

Then run the command shown in this example and you will have a random Cockney fortune…

jason@darknet:~$ fortune -s | cockney
Q:	'ow menny psychiatrists does i' tike to change a loit bulb, roit?
A:	Only one, but i' takes a long toime, 'n' the bloody loit bulb 'as
	to really want to change.

Another example.

jason@darknet:~$ fortune -s -l | cockney
Fortune: Y'will be attacked next Wednesday at 3:15 p.m. by six samurai
sword wieldin' purple fish glued to 'arley-Davidson motorcycles.
 
Oh, 'n' 'ave a nice day!
		-- Bryce Nesbitt '84

This command-line parameter used with the cal command will show how many days have passed in the year since January 1.

jason@darknet:~$ cal -j
        March 2016           
 Su  Mo  Tu  We  Th  Fr  Sa  
         61  62  63  64  65  
 66  67  68  69  70  71  72  
 73  74  75  76  77  78  79  
 80  81  82  83  84  85  86  
 87  88  89  90  91

Another nice way to show off on your computer is to install the cowsay package and then run this command.

jason@darknet:~$ fortune | cowthink | cockney
 _________________________________________
( Fime is a vapor; popularity an          )
( accident; the bloody only earvly certainty is )
( oblivion.                               )
(                                         )
( -- Mark Twain                           )
 -----------------------------------------
        o   ^__^
         o  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Putting together everything we have installed during the reading of this post; here is another cool command using another cowsay character.

jason@darknet:~$ fortune -l | fudd | cowsay -f /usr/share/cowsay/cows/luke-koala.cow
 ________________________________________
/ "I undewstand dis is youw fiwst dead   \
| cwient," Sabian was saying. De         |
| absuwdity of de statement made me want |
| to waugh but dey don't caww me Deadpan |
| Awwie and wie.                         |
|                                        |
\ -- Pat Cadigan, "Mindpwayews"          /
 ----------------------------------------
  \
   \          .
       ___   //
     {~._.~}// 
      ( Y )K/  
     ()~*~()   
     (_)-(_)   
     Luke    
     Skywalker
     koala
The insides of a neat computer.
The insides of a neat computer.

More useful shell tricks.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.