Check These Out
This command shows the various shortcuts that can be use in bash, including Ctrl+L, Ctrl+R, etc...
You can translate "\C-y" to Ctrl+y, for example.
underline() will print $1, followed by a series of '=' characters the width of $1. An optional second argument can be used to replace '=' with a given character.
This function is useful for breaking lots of data emitted in a for loop into sections which are easier to parse visually. Let's say that 'xxxx' is a very common pattern occurring in a group of CSV files.
You could run
$ grep xxxx *.csv
This would print the name of each csv file before each matching line, but the output would be hard to parse visually.
$ for i in *.csv; do printf "\n"; underline $i; grep "xxxx" $i; done
Will break the output into sections separated by the name of the file, underlined.
This is assuming that you're editing some file that has not been wrapped at 80 columns, and you want it to be wrapped. While in Vim, enter ex mode, and set the textwidth to 80 columns:
$ :set textwidth=80
Then, press:
$ gg
to get to the top of the file, and:
$ gqG
to wrap every line from the top to the bottom of the file at 80 characters.
Of course, this will lose any indentation blocks you've setup if typing up some source code, or doing type setting. You can make modifications to this command as needed, as 'gq' is the formatting command you want, then you could send the formatting to a specific line in the file, rather than to the end of the file.
$ gq49G
Will apply the format from your current cursor location to the 49th row. And so on.
This command finds and prints all the symbolic and hard links to a file. Note that the file argument itself be a link and it will find the original file as well.
You can also do this with the inode number for a file or directory by first using stat or ls or some other tool to get the number like so:
$ stat -Lc %i file
or
$ ls -Hid file
And then using:
$ find -L / -inum INODE_NUMBER -exec ls -ld {} +
Every time this is run it will change your background picture. For added fun
Add some DBUS magic:
. $HOME/.dbus/session-bus/`cat /var/lib/dbus/machine-id`-0
export DBUS_SESSION_BUS_ADDRESS
and a crontab entry:
*/5 * * * * above_command_in_script.sh >/dev/null 2>/dev/null
now wallpaper changes every 5 mins
A null operation with the name 'comment', allowing comments to be written to HISTFILE. Prepending '#' to a command will *not* write the command to the history file, although it will be available for the current session, thus '#' is not useful for keeping track of comments past the current session.
Finds the string in every file in an entire directory and all its subdirectories and replaces it with a new string. Especially useful when changing a machine's IP address or hostname - run it on /etc.
nsacodenamegenerator dot com is no more
outputs random two words together in capital letters