Posts

Showing posts with the label Linux Tricks & Tips

3 Linux Tips to Show File Contents with Line Numbers

Image
  Tamizh Tech Tutorial 3 Linux Tips to Show File Contents with Line Numbers                  (3 Examples) In this tutorial, you will learn 3 tips to display the file contents along with line numbers in linux / unix with examples Three Tips Using cat command with option -n Using bat command without option Using nl command without option 1. Using cat command with option -n This command is used to display the file contents with special option -n Syntax cat -n filename Where, f ilename is an existing input filename. Example  2. Using bat command This is the latest linux command, similar to cat command This command is also used to display the file contents without any option. NOTE By default, this command is not installed on your machine. So you need to install it externally based on your distribution before using it. Syntax bat filename Where, f ilename is an existing input filename. Example 3. Using nl command nl stands for line numbers, an alternative to cat command This command

2 Linux Tips for Decompressing File in Unix / Linux

Image
  Tamizh Tech Tutorial 2 Linux Tips for Decompressing File in Unix / Linux Linux Tips Here you can find two tips to decompress the already compressed file in unix / linux terminal with examples. They are Using gzip command Using gunzip command 1. Using gzip Command with option -d This command with option -d is used to decompress the compressed file. Syntax gzip -d file.gz Example 2. Using gunzip Command This command will be used to decompress the file without taking option in linux / unix terminal. Syntax gunzip file.gz Example Tamizh Tech Tutorial

7 Linux Tips for Displaying Contents of File in Linux

Image
  Tamizh Tech Tutorial 7 Linux Tips for Showing File Contents in Unix / Linux Linux Tips Here you can find several tips for displaying file contents in unix / linux terminal with examples. They are Using cat command Using head command Using tail command Using more command Using less command Using nl command Using nano command (pico command) 1. Using cat Command This command will take a file as an input and display it on the standard output which is the terminal output. Syntax         cat filename Example 2. Using head Command This command will take a file as an input and display the top ten lines by default on the terminal. Syntax         head filename Example 3. Using tail Command This command will take a file as an input and display the bottom ten lines by default on the terminal. Syntax         tail filename Example 4. Using more Command This command will take a file as an input and display the file contents in pager form,  displaying one screen at a time in case the file is too lar

4 Linux Tips to Show File Size in Linux

Image
  4 Linux Tips to Show File Size in Linux In this blog, you will get four different tips to get a file size in linux / unix using commands. They are using ls command (ls -s) using du command (du -s) using stat command using wc command (wc -m) 1. using ls command This command is used to show the file size in KB using the option -s . Syntax                              ls -s <filename> Contents of Input file msg.txt Example:          ls -s msg.txt 2. using du command Like ls command, this command is also used to show the file size in  KB using the option -s . Syntax                         du -s <filename> Example:        du -s msg.txt 3. using stat command This command is optional for ls command This is also used to display the file size   Unlike ls and du command, this command will display the size in bytes . Syntax                         stat <filename> Example:        stat msg.txt 4. using wc command (wc -m) This command is also used to display the size of file

3 Linux Tips to Display Message in Terminal

Image
 3 Linux Tips to Display Message in Terminal In this blog, you will learn 3 linux tips to display the message in linux terminal. This is done by using three commands. They are using echo command using printf command using read command with option -p 1. using echo command This popular command is mainly used to show the message on terminal. This will take message as an input and display the input on terminal. Example - echo "Hello World" 2. using printf command This command is optional for echo command This will take message as an input and display the input on terminal. Example - printf "Hello World\n" 3. using read command This optional command is used to print the message with help of special option -p. p stands for printing the message This will take message as an input and display the input on terminal. Example - read -p "Good Morning"