Saturday, 17 November 2012

Useful UNIX Commands

# OS version and Details
uname -a

# Replace ^m
:%s/^V^M//g

# To Get the Delimited value
cut -f5 -d \~

#Mail Server Details
Look for relay Host in the below file.
more /etc/mail/sendmail.cf

# Find a word in
find . -exec grep hello {} \; -print

#To find a file in any directory, starting in your current directory
$ find . -name filename

#If you do not know the complete filename,use the wildcard \* at the start and end of the filename.
$ find . -name \*partialfilename\* -print

#Find only files (not directories) from your current directory. For example,
$ find . -type -f -print

#And to find only directory files,type
$ find . -type -d -print

#To find all files containing a particular string
$ find . -name "\*" -exec grep "string" {} \\; -print

#To find all files that are greater than "n" bytes and have not been accessed for more than "x" days,
$ find . -type f -size +nc -atime +x

For example, to find a file greater than 800 bytes and not accessed for more than 10 days, type
$ find . -type f -size +800c -atime +10
The c indicates that the file size is in bytes.


sftp -oPort=2222 user@123.456.789.012:/home/something


lftp -c 'open -e "set ftps:initial-prot ""; \
   set ftp:ssl-force true; \
   set ftp:ssl-protect-data true; "\
   <your FTP command>; " \
   -u "USERNAME","PASSWORD" \
   ftps://HOSTNAME:990 

No comments:

Post a Comment