Friday, July 11, 2014

Unix Commands

GENERAL COMMANDS

1. Check all environment Variables
$ env
$ printenv
2. Grep Command
grep '2012-03-27' /path/tomcat/apache-tomcat-6/logs/catalina.out | grep '9927773'

SVN COMMANDS

1. Checkout a code base
$ svn checkout <checkout url>

OR
$ svn co <chekout url>
2. Update a code base
$ svn update
3. Check-in/Commit files
$ svn ci -m “commit message”
4. Check current svn check-in details
$ svn info

COPY COMMANDS

1. Copy file from one server to another
We have a file (/prod/myfile.zip) in Server 1 and needs to be copied to Server 2 (/data/test/)
Server 1 (ip: 10.5.55.20) - Source Server
  username: ranjith
  password: sekar   
Server 2 (ip: 10.3.33.90) - Destination Server
  username: anbu
  password: selvan
Now login to Server 1 and enter below command
$ scp /prod/myfile.zip anbu@10.3.33.90:/data/test/
$ <enter password: selvan>

DELETE COMMANDS

1. Delete a folder in current directory
$ rm -rd <folder>
2. Delete a folder and its sub folders
$ rm -rf <folder>

FILE MANIPULATION COMMANDS

1.View Content of a file (less command)
$ less <filename>

1.1 To traverse the file

$ spacebar => Next page
$ b => previous page
$ g => top of the page
$ shift + g -=> bottom of the page

1.2 To search a string

type /<string> and enter
2.Delete a content of file
cat /dev/null &gt; processLog.txt
3. Create shortcut for a file.
ln -fs /folder1/folder1-subfolder/index.html /folder2/folder2-subfolder/

No comments :

Post a Comment