Mar 3, 2010

Commands That we use regularly in Job

FTP the file from one server to other (commands)

1.ftp
2. Login to the other server
3. choose the directory you want to move the file(with cd /folder1/folder2....)
4. Use Command put(put ) for multiple files(mput). Similarly the get command


Attach the file in unix to mail
uuencode filename filename | mail XX@XX.com


ls -la to list the hidden files.

Unzip a file:
Use gunzip filename.gz
Zip a file
Use gzip command(syntax: gzip filename)


To run .ksh file
just type scriptname.ksh and press enter or use ksh scriptname


To know where are you exactly in Unix use pwd command
To Know what user u have login command is whoami
To know which groups are u belong to by typing groups username command.


And all other commands like cd,mv,cp,head,tail all we know normally.


To list all the files according to size(see below command)
ls -l|sort +4 -nr


To see how much space used in unix
df -k (give the path name) and also du -sH to know how much space used 


To Know which shell you are using
type echo $shell result is like this /usr/bin/ksh(ie korn)


displays information about the operating system
$ uname result is like Linux or AIX


you can use the history command to view the command history
$ history or fc -l command
examples:
1 12:30 echo $history 
2 12:30 history 
3 12:30 pwd 
4 12:30 cd web_files/ 
5 12:31 history


To remove control-M from file in unix use  this command
dos2ux input_file_name > output_file_name 

To find particular file in unix server: go to the particular folder and type below command
find . -name 'filename' -print 
Search current directory and all subdirectories for all .c files last modified less than 3 days ago
find . -name '*.c' -mtime -3 
Search current directory and all subdirectories 
 find . -name 'tnsnames*'
 Search for all files without the .txt extension
find . -not -name "*.txt"
 
grep Command:
grep -c "string_name$" filename
$ indicates end-of-line (and ^ would indicate start-of-line)
-c option of grep tells you the count instead of actual lines


No comments:

Post a Comment