Hello friends, In this article, we added 6 basic tips to Linux users. These command line codes dealing with removing the unused or unwanted packages from the Linux server, getting the IP of your Linux based PC, getting local and remote IP using Linux command lines, preview colorful terminal in output using the command line & ultimately hashtags implementation in Linux Server.
- How to remove unused packages in Linux?
- How to get local and remote server IP address?
- How to color your Linux terminal?
- How to implement Hashtags in Linux server?
- How to create command line chats?
- How to add (sum) values in a column in Linux?
How to remove unused packages in Linux:
This unused package is otherwise named as “Orphan Packages”, these are installed as the dependency of another package. This package no longer required when the original package is removed. For instance, we installed a package named as “gtprogram“. Without gtdependency, we can’t install the gtprogram.
When you tried to uninstall the gtprogram application it will remove completely but the gtdependency will exist on the pc by default. This package can be termed as an Orphan package.
How to get a local IP address in your Linux PC:
To get you Linux pc IP address and then we suggest you use the below commands.
The above code will provide you with the IP address of your Linux PC. As you know “ifconfig” is mainly used to show the IP address, but it generates a lot of IP address with your PC address. To filter out your PC address and then you need to add “inet addr” with the “if config” & as a result, the IP address will appear on your Linux terminal.
We can create the output more custom now. For this, we need to create a filter our local IP address and remaining should be nothing. You just need to use “awk” along the above code. This code will print the second column of your IP address list.
From the above image that you will be able to customize your output IP address list and the look back IP address is 127.0.0.1 is still in the output. To remove this follow the below method.
Here “-v” with grep will print the lines which are not matched with the given arguments. The look back IP address will be the same for every Linux machines and by using “-v” along with grep will helps you to remove the unwanted IP address. On this step, we completed 90% of creating the output.
The remaining 10% can be achieved by executing the following commands. Replace the strong “addr” with “cut” following by the using of delimiter -d. The “cut” command will help you to print the first and second column. Usually, the first column and second column will not tab but by using (:). By using the “-d” will generate the output alone in the command line.
Ultimatlely the final output has been generated.
How to colour your Linux Terminal:
You guys will get easily bored of seeing the black & white colour terminal. So here we are going to provide the command line codes that will help you to convert your terminal from black & white to colourful terminal.
The file “.bashrc” is mainly used to handle the output of terminal. You need to edit the directory and then change the following codes inside the “.bashrc” file. This file is hidden usually in Linux and you just need the add the codes at the beginning of the codes, Simple right !!.
Use the above command to open the terminal handler file and then add the following codes in the top of the file.
Then restart the Linux Server and open the terminal now, you will be able to see the terminal has been changed from black & white to colourful terminal.
Image Credit: Wikipedia
The files and folder are in a different colour based on the type of file. To decode the colour of the files and folder you just add the following command in the terminal.
The output of the above code is very large and it will take a huge time consumption to get the end. And so we suggest you use the following command will show the lesser output.
How to implement Hashtags in Linux Server:
The usage of Hashtags here is mainly for searching. Searching a keyword with # will make the process very very simple as possible. This method is already used in the famous social websites like Facebook & Twitter. Only pro guys will know that it is possible to use the Hashtags in the Linux terminal.
Most of the languages consider it as the # as the comment. In Linux, the Hashtags are used in the configuration files. For finding through the Hashtags you just need to run a sample command initially and then to find it later using the Hashtags.
As a sample, we create the hashtags for the previous command and execute it. Then we will able to find the value of the hashtags that have been stored previously.
The above code is tagged with “mypcip” hashtag. In the terminal, just enter the hashtag name with “#” the value of the hashtag will appear on the terminal otherwise you just the enter the following command to view the hashtag value and the command is “reverse-i-serach”
How to create command line chat in Linux:
We can create command line chat box using the terminal in the Linux. Everyone knows that the most famous messaging or chat applications are “Whatsapp, Fb Messenger & phone messaging app”. This Linux terminal chat box can be able to chat with your friends using their IP address. This chat is faster than any other messaging applications.
The Linux chat can be achieved through the NC method. The term NC means “Net Cat” method. This method is one of the most powerful methods and so it is compared to many other important things in Linux commands. The usage of NC methods are :
- Debug tool
- Diagnosing tool
- Investigation tool
- Reading tool
- Writing tool
- Reverse DNS checking tool
- and more
This NC method will work on the port and so it is mainly used to monitor the backdoors, port configurations and port incoming and outgoing bandwidth reference details. To create an instance chat application just follow the code in the terminal.
Explanation of Switches and Commands:
- -v : Verbose
- -vv : More verbose (multiply for verbose)
- -p : Local port address
You can terminate the chat session by clicking the “ctrl + c”
otherwise execute the command “one-to-one” service.
How to Add (Sum) two values in the command line:
The following command will help you to add the two values in the column. The output of the function will appear in the terminal too. The command for adding the two values is :
To Print Particular Column Value:
The above code will print the output value in the numerical form, For printing the particular column value you must need to do some extra work and they are:
The above code will list the value of column 5 and nothing else. $5 represents the column number & “awk” used for filter purpose. Now again use the “awk” code to print the sum of the 5th column values and the following code will do that function.
That’s it, friends. We are working very very hard to provide a good articles for improving your knowledge on the Linux platform and the above 6 tips will enhance your Linux skill. If you have any queries and then feel free to comment us and we will reply soon.