- Thursday, February 4, 2010, 13:36
- General
- 949 views
Following are some bunch of commands that might be useful if you want to find files in unix/linux.
Large Files
Find files larger than 10MB in the current directory downwards...
find . -size +10000000c -ls
Find files larger than 100MB...
find . -size +100000000c -ls
Old Files
Find files last modified over 30days ago...
find . -type f -mtime 30 -ls
Find files last ...
Full story
- Tuesday, January 12, 2010, 18:21
- How-To
- 150 views
Unix File Line Ending always gives you problem if you have your development environment in Windows and servers in Unix. Also if you are using Subversion as source control system then you need to be very careful about line endings.
I had this issue where a shell script was deployed on Unix machine. But I was not able to run the shell script. It gave error:
$> ...
Full story
- Tuesday, November 24, 2009, 15:45
- How-To
- 296 views
Shell Script is fun. I love it when I know which commands to use. There are almost thousands of
Here is a simple trick to Replace Text and Variables in Files in UNIX. We will use command sed - it is very useful to find and replace text in single or multiple files.
Replace Text in Single ...
Full story
- Thursday, August 27, 2009, 19:25
- General
- 489 views
Problem Statement: I have few files in source directory. I have to move them to another destination directory. The source directory have *.txt files that needs to be moved to destination directory. The destination filename should be *.txt.backup.
So how to accomplish the above task in Unix Shell Script?
Well the solution is simple:
cd source/
for file in *.txt
do
mv "${file}" ../destination/"${file}.backup"
Run a loop for each ...
Full story
- Wednesday, August 5, 2009, 14:58
- General
- 1,561 views
RANDOM is a peculiar shell variable, but useful nonetheless. Peculiar because its value changes each time it is referenced (yes, this is by design).
As you may have already guessed, RANDOM is a random number generator. The number generated is an integer between 0 and 32767, and can come in handy when writing shell scripts. ...
Full story
- Thursday, July 9, 2009, 15:27
- General
- 5,078 views
Have you ever written a huge Unix script and thought you would have divided this script into pieces of reusable code? Well don't worry. You can create functions in unix shell script and make reusable code and call the function from your unix code.
Hello World Function in Unix shell script
First let us see a simple ...
Full story