Posts

Showing posts with the label terminal

Malicious Linux commands to avoid

Warning: Don't run these commands on your machine. They can erase your valuable data or crash your machine. It is worthwhile to have basic knowledge about malicious commands in Linux.  Don't blindly run the commands instructed in websites or scripts downloaded from the internet. Just verify the contents of the script for any commands that can harm your computer. If you want to know what a command can do use the man pages if you are offline. You can get the information of a command by typing info <command name> in the terminal. Example:  info sudo If you are connected to the internet then type man <command name> in the terminal to get the updated documentation. Example:  man sudo Again, the following commands can heavily damage your OS. These are extremely dangerous and should not be attempted on any computer that has any physical connection to valuable data. 1.   COMMANDS THAT CAN DELETE FILES AND FOLDERS rm -rf / ...

Coloured man pages!

Image
Are you bored from viewing monochrome(black & white) man pages?  Let's make the world a little bit colorful. coloured man page Colored man pages allow for a clearer presentation and easier digestion of the content. Let's see how to do it. Method 1: Open a terminal and type the following codes: sudo apt-get install most export PAGER="most" That's it now open your favorite man pages   and you will be awestruck to see colored man pages. Method 2:  This method has the advantage that  less  has a bigger feature set than  most , and is the default for viewing man pages. Add the following to a shell configuration file. All that needs to be done is to export bold and underline values of termcap. Adding the values to the  ~/.bashrc  will make sure that they are always used: # Less Colors for Man Pages export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold export LESS_TERMCAP_me=$'\E[0m'...

Make searching history in terminal easier

PROBLEM: This might not be a problem but a feature . But I want to mention this here. Some times while using the terminal you might know a command which is very big and you've already used it before.  That means it's in the terminal history and you want to use it. It is really irritating to hold the up arrow ( ↑) until you find it. So, here's an useful feature that allows you to search the history just by typing the first few letters of your command in the terminal. Let me illustrate what we want to achieve using an example.  sudo -s ls man sudo If I want to use  sudo -s I have to press  ↑ three times. Instead of that I can use it by typing S and pressing ↑. Let's see how to do it. SOLUTION: Open a terminal and type the following: gedit ~/.inputrc ## arrow up "\e[A":history-search-backward ## arrow down "\e[B":history-search-forward Now we can search easily in the terminal.

Advancing with the terminal

Advancing with the terminal In the previous post we discussed about the basics of the terminal. In this post I will tell you about advanced commands that can be used in the terminal. System Information Commands: These commands are used to know information about the system.        df :      The df command displays file system usage for all the  mounted partitions. df –h produces a more readable output in Megabytes (M) and Gigabytes (G). [-h means human-readable]. ¨     du :   The du command displays the disk usage for a directory. For more readable output you can use du –sh. ¨     free : The   free command displays the free and used memory in the system. Free –m will give the output in Megabytes which is more readable. ¨     top : The top command   displays information on your Linux system, running processes and system resources, including CPU, RAM & swap usage and total numbe...