UNIX Commands

These are some interesting UNIX Commands are used during the middleware administration.

1. To set the “tree” alias to list all the directory in the UNIX terminal as tree structure.

tree=’ls -R | grep :$ | sed -e ‘\”s/:$//’\” -e ‘\”s/[^-][^\/]*\//–/g’\” -e ‘\”s/^/ /’\” -e ‘\”s/-/|/’\’

Output of the above command is like this:


2. “find” command.
One of the useful command to find the files and directories in the UNIX file system is “find” command. The find command takes the following argument to identify the files or directory in UNIX file system.

find . -type f -print -exec grep -i “type your string here to find” {} \;

To find out the result and we can use the output to filter the result strings.

find . -name *.txt | xargs du -h|grep -i M

The below command gives the same output, but we can not use the output to other grep commands.. (may be I don’t know how to use that)

find . -name “test*” -exec du -sh {} \;




  1. Command to delete logs that are older than 365 days

    find . -name “*.log” -mtime +365 -exec rm {} \;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: