Check These Out
Put the cursor on either curly braces ( {, } ). Then press d%
The d is delete command, and % is movement command that move the cursor to another matching parentheses (or curly braces in this case). This action will delete every character that was on the way of the movement (from the first curly braces to the second).
in command mode, navigate your cursor to the line where you want the command output to appear, and hit "!!". No need to enter edit mode or even type a ":" (colon).
This command sequence allows simple setup of (gasp!) password-less SSH logins. Be careful, as if you already have an SSH keypair in your ~/.ssh directory on the local machine, there is a possibility ssh-keygen may overwrite them. ssh-copy-id copies the public key to the remote host and appends it to the remote account's ~/.ssh/authorized_keys file. When trying ssh, if you used no passphrase for your key, the remote shell appears soon after invoking ssh user@host.
This creates a permanent stock ticker in the terminal. it has scrolling action and refreshes when each cycle is done to get the latest news.
Unsetting HISTFILE avoid getting current session history list saved.
This loop will finish if a file hasn't changed in the last 10 seconds.
.
It checks the file's modification timestamp against the clock.
If 10 seconds have elapsed without any change to the file, then the loop ends.
.
This script will give a false positive if there's a 10 second delay between updates,
e.g. due to network congestion
.
How does it work?
'date +%s' gives the current time in seconds
'stat -c %Y' gives the file's last modification time in seconds
'$(( ))' is bash's way of doing maths
'[ X -lt 10 ]' tests the result is Less Than 10
otherwise sleep for 1 second and repeat
.
Note: Clever as this script is, inotify is smarter.
If the password for the share your trying to mount contains special characters you can use URL escape characters.
The above command uses an example as follows:
username: user
password: p@ss
URL Encoded password: p%40ss
All credit goes to Richard York:
http://www.smilingsouls.net/Blog/20110526100731.html
Also check out this URL Decoder/Encoder to convert your passwords.
http://meyerweb.com/eric/tools/dencoder/
Good old bracket expansion :-)
For large numbers of files, "rename" will spare you the for-loop, or the find/exec...