Search for Tips & Tricks

Google
 
Showing posts with label Tricks. Show all posts
Showing posts with label Tricks. Show all posts

Wednesday, February 27, 2008

Bash command line key bindings

Ctrl + a - Jump to the start of the line
Ctrl + b - Move back a char
Ctrl + c - Terminate the command
Ctrl + d - Delete from under the cursor
Ctrl + e - Jump to the end of the line
Ctrl + f - Move forward a char
Ctrl + k - Delete to EOL
Ctrl + l - Clear the screen
Ctrl + r - Search the history backwards
Ctrl + R - Search the history backwards with multi occurrence
Ctrl + t - swapping of the last two char
Ctrl + u - Delete backward from cursor
Ctrl + xx - Move between EOL and current cursor position
Ctrl + x @ - Show possible hostname completions
Ctrl + z - Suspend/ Stop the command
Ctrl + / - Undo last command-line edit
Ctrl + P - Previous command line
Ctrl + N - Next command line (useful for "scrolling" with Ctrl+P)
Ctrl + H - Backspace

Tuesday, January 22, 2008

How to list file that doesnot contains some string

Llist files that does not contain string 'dat' in file name

$ ls *[!dat]

Sunday, January 20, 2008

How to open remove application on local machine

This can be done using xhost utility:

Step 1. On the local host

Type the following at the command line:

$ xhost +

Step 2. Log on to the remote host

$ telnet

Step 3. On the remote host (through the telnet connection)

Instruct the remote host to display windows on the local host by typing:

$ setenv DISPLAY :0.0
->> user zsh ( shell)
at the command line. (Instead of setenv you may have to use export on
certain shells. in bash shell use DISPLAY=:0.0)

Step 4. Now you can run software from the remote host.

E.g.: when you type $ xterm on the remote host, you should see an
xterm window on the local host.

Step 5. After You Finish

You should remove the remote host from your access control list as follows.
On the local host type:

$ xhost -

How to Extract a single line from a file

$sed -ne 5p help | /bin/bash

The above command will extract 5th Line from the file 'help'