Find and grep

grep command syntax

grep "text string to search" directory-path

To search for a string called redeem reward in all text files located in /home/tom/*.txt directory, use

$ grep "redeem reward" /home/tom/*.txt

To recursively search for a text string all files under each directory, use -r option:

$ grep -r "redeem reward" /home/tom

find command syntax

$ find path expression

Using the command line, you can search for files larger than a given filesize using

$find path -size +1024k

$find path -size +5M -print


VNC vncserver and tigervnc

First, use yum to install the server service:

yum install tigervnc-server 

Then, edit the servers file:

vi /etc/sysconfig/vncservers

Edit this:

# VNCSERVERS="2:myusername"

# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost" 

To look like this:




Tar with compression

The Unix tar command

# tar -cvzf foo.tgz cps100

will tar the directory cps100 (and its files/subdirectories) into a tar file named foo.tgz.

To see a tar file's table of contents use:

# tar -tzf foo.tgz

Extract Tar or UnTar gzip files

To extract the contents of a tar file use (works with both .tar and .gz files):

# tar -xvzf foo.tgz

This untars/extracts (x) into the directory from which the command is invoked, and prints the files being extracted (v).


Tar without compression

To combine multiple files and/or directories into a single file, use the following command:



Subscribe to RSS - Linux