Sunday, April 06, 2025


Shell Programming Blog Shell Programming Blog

Sunday, 30 September 2012

Linux terminal freezing problem [resolved] :-)

Unknown | 03:48 | Be the first to comment!

I often wonder why my Linux terminal freezes when I press certain key combinations unknowingly. Finally when I found the key combination, I found that I pressed Ctrl+s key. Which is used for...

How to display the text in Bold and Underline in Linux

Unknown | 03:42 | 3 Comments so far

   To display the test in "BOLD" and "UNDERLINE", the following ANSI Escape Sequences can be used. To display the text in BOLD$ echo -e "\033[1mThis is a BOLD line\033[0m"This is a BOLD...

Saturday, 29 September 2012

How to sort the files and directories based on their size

Unknown | 23:25 | | | Be the first to comment!

Let us see how to sort the files and directories. In my current directory, I have the following files and sub-directories:$ file *config: directoryval.dat: ASCII textsample.txt: ASCII textlog: directoryi.e.,...

How to list the empty directories in Linux

Unknown | 22:37 | Be the first to comment!

  The find command in Linux has an option called 'empty'. This option can be used to list empty regular files or empty directories. e.g.To list all the empty directories$ find . -type d -emp...

How to find the past and future dates using date command

Unknown | 11:53 | Be the first to comment!

    The "date" command in Linux is used to display the current date and time. But, we can also make the date command to display past and future dates based on the inputs/parameters that...

Friday, 28 September 2012

How to calculate the size of a directory in Linux

Unknown | 12:09 | Be the first to comment!

  Let us see how to calculate the size of a directory including its sub directory. To calculate the total folder size of folder "bin"$ du -sh bin/280K bin/-s, --summarize (display only a total...

How to find largest files in a directory and its sub directories

Unknown | 11:15 | Be the first to comment!

A situation may occur in your office that you might have to clear the space in the server by deleting the largest files in the log directory. If you want to find and print the top 10 largest...

How to remove duplicate entries from a file without sorting

Unknown | 10:58 | Be the first to comment!

  Usually whenever we want to remove duplicate entries or lines from a file, we need to sort the entries and then eliminate the duplicates using "uniq" command. But if we want to remove...

How to exclude or skip a directory while searching for a file using FIND command

Unknown | 10:33 | Be the first to comment!

Find command is used to search the files in the Linux environment. This find command will search all the directories and the sub directories in the path which we give in the find command....

Wednesday, 26 September 2012

Sorting the file leaving the first line and writing in a file

Unknown | 10:43 | 1 Comment so far

Now we can see how to sort a file by leaving the first line as it is. For example, we take a file sample.txt which contains the below data. chrom:index:forward:reverse chr01:13:1:2 chr13:23432:4:7 chr01:3445:1:6 chr02:2311:3:1 chr01:212:5:2 chr03:12:1:4 chr02:345:12:6 chr01:45:45:0 If...

Tuesday, 25 September 2012

How to use Arrays in Shell scripts

Unknown | 10:28 | 2 Comments so far

We know what an array is. An array is a variable which can store multiple values in the same name. These values can be accessed by using the subscripts. The whole of the array can be accessed by...

Monday, 24 September 2012

How to print the lines to the screen with line numbers

Unknown | 10:45 | Be the first to comment!

As you know, the CAT command prints the lines of the file to the screen in the ASCII format. This is one of the command that is used to view the content of the file without opening the file in an...

look command to print lines in Linux

Unknown | 10:32 | 1 Comment so far

  Let me introduce a simple UNIX/Linux command which is very useful but not that popular. The name of the command is 'look'. As the name suggests, this command displays lines beginning with...

Sunday, 23 September 2012

How to find the length of a string in Linux/Unix Shell scripting

Unknown | 20:16 | 2 Comments so far

While writing a shell script you might want to find the length of a string. While reading GNU expr command man page I found an interesting option: expr length STRING For example display the length...

A shell script to normalize the month field in the given date

Unknown | 08:25 | Be the first to comment!

   This script will normalize the month field in the given date to three letters and the first letter would be capitalized. #!/bin/sh # normdate - Normalizes month field in date specification #...

Saturday, 22 September 2012

How to recover the files from pen drive or removable disk which are affected due virus attack?

Unknown | 22:28 | Be the first to comment!

Nowadays USB pen drives are used by most of the people to transfer and save the data. A very important problem in the USB pen drives is virus infection. Since the pen drives are being  used in...

வைரஸ் தாக்கிய ‘பென்ட்ரைவ்’ இலிருந்து பைல்களை மீட்க சிம்பிள் வழி!

Unknown | 21:49 | Be the first to comment!

தற்பொழுது தகவல்களை சேமிக்க பெரும்பாலானவர்களால் பயன்படுத்தப்படுவது USB பென்டிரைவ்கள். இதில் முக்கியமான பிரச்சினை வைரஸ் பிரச்சினை. வெவ்வேறான கணனிகளில் உபயோகிப்பதால் வைரஸ்கள் சுலபமாக பென்டிரைவில் புகுந்து...

How to make web links open in Firefox 15 by default?

Unknown | 11:44 | Be the first to comment!

If you have more than one web browser, Windows needs to know which browser to use by default. This article will show you how to make Firefox your default browser. At the top of the Firefox window,...

 

Shell Programming Copyright © 2012 Shell Programming theme is Designed by Abusittik, Shell Programming