Author: Sahil Suri

10 ps command examples in Linux/Unix

Linux ps commandThe ps command is a basic but important command because it is used to display information about processes running on the system. System administrators often rely on the ps command to monitor currently running processes. There are numerous options available to tweak the output of the ps command and we will be exploring many of them in this article.The ps command obtains it’s information from the /proc virtual file system and displays it to the screen in a meaningful manner as per the options specified while executing the command.It has two distinct modes of syntax: the UNIX style and the BSD style and we’ll cover both in this article.To distinguish between using ps via either of the styles simply be mindful that when using the BSD style the options used with the ps command are not preceded with a dash.With a basic understanding of what the ps command is and where it gets its information from, we now proceed to the examples to understand its usage.Example 1:When run without any options the ps command displays processes owned by the current shell.[root@linuxnix ~]# ps PID TTY TIME CMD 2585 pts/0 00:00:00 bash 9114 pts/0 00:00:00 psGiven below is a brief description of the various fields reported in the output:PID is the Process ID of the running command (CMD)TTY is the place where the running command runsTIME tells about...

Read More

18 tr command examples in linux/Unix

Along with the Linux sed command, the tr command stands for translate is used to provide a level of swapping or translation, suppression or deletion of files. The tr command just translates one character to another character. In this article, we’ll share a couple of examples demonstrating some exciting things that we can do with the tr command. The basic syntax for the tr command tr [OPTION] [SET1] [SET2] SET1 denotes what we wish to translate in the input file, and SET2 means what we want to convert SET1 as the output of the translation. So the sets can be a single character or multiple characters. Example1: Suppose you just want to replace a in “sahil suri” with b we can use tr sets. We use echo command to send “sahil suri” to tr command. The tr command by default is not able to read data stream. We use Linux inbuilt redirection operators to feed data to tr command. [root@linuxnix:~]# echo "sahil suri" | tr 'a' 'b' sbhil suri Example2: Suppose if you want to replace multiple characters one after the other then we can use below-set examples. Suppose you want to replace a with b, r with x and i with z, below is the case you are looking at. [root@linuxnix:~]# echo "sahil suri" | tr 'ari' 'bxz' sbhzl suxz Note: Make sure that first set and second...

Read More

12 wget command examples in Linux/Unix

What is wget command? The ability to download content from the world wide web (the internet) and store it locally on your system is an important feature to have. The wget(Web get) command line utility is a freely available package which can be used to retrieve files from the web using HTTP, HTTPS, and FTP protocols. In addition to the mentioned protocols, wget can also be used to download files through HTTP proxies. This is similar to cURL command which we covered recently. One very useful feature of wget is that it is non-interactive and therefore can be easily used in scripts and cron jobs. This allows wget to be used to download files as part of triggering a specific action or retrieve files at a specific point in time. It is also worth noting that wget is designed to work with unreliable network connections and has the ability to resume downloads interrupted due to network disruptions. We can use wget to download files recursively and also set the number of times wget will try to resume an interrupted download. In this article, we show you some useful examples implementing the features of the wget command we’ve mentioned thus far. Before proceeding with the examples, let’s first verify that the command is available on the system. [root@linuxnix ~]# which wget /usr/bin/wget [root@linuxnix ~]# rpm -qf /usr/bin/wget wget-1.12-10.el6.x86_64 [root@linuxnix ~]#...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.