Sunday, November 18, 2007

Linux/UNIX Basic Commands - Part 2

Hi Friends,

Here is the continuation of the topic Linux/UNIX Basic Commands Part 1.

SSH:

ssh user@host – connect to host as user
ssh -p port user@host – connect to host on port as user
ssh-copy-id user@host – add your key to host for user to enable a keyed or passwordless login

Searching:

grep pattern files – search for pattern in files
grep -r pattern dir – search recursively for pattern in dir
command | grep pattern – search for pattern in the output of command
locate file – find all instances of file

Compression:

tar cf file.tar files – create a tar named file.tar containing files
tar xf file.tar – extract the files from file.tar
tar czf file.tar.gz files – create a tar with Gzip compression
tar xzf file.tar.gz – extract a tar using Gzip
tar cjf file.tar.bz2 – create a tar with Bzip2 compression
tar xjf file.tar.bz2 – extract a tar using Bzip2
gzip file – compresses file and renames it to file.gz
gzip -d file.gz – decompresses file.gz back to file

Network:

ping host – ping host and output results
whois domain – get whois information for domain
dig domain – get DNS information for domain
dig -x host – reverse lookup host
wget file – download file
wget -c file – continue a stopped download

Installation

Install from source:
./configure
make
make install
dpkg -i pkg.deb – install a package (Debian)
rpm -ivh pkg.rpm – install a package (RPM)
yum install pkgname - using the yum tool

Shortcuts:

Ctrl+C – halts the current command
Ctrl+Z – stops the current command, resume with fg in the foreground or bg in the background
Ctrl+D – log out of current session, similar to exit
Ctrl+W – erases one word in the current line
Ctrl+U – erases the whole line
Ctrl+R – type to bring up a recent command
!! - repeats the last command
exit – log out of current session

Thanks

Logu
logu_microsoft@hotmail.com
91-98414-99143

No comments: