Check These Out
Handy when you need to create a list of files to be updated when subversion is not available on the remote host. You can take this tar file, and upload and extract it where you need it. Replace M and N with the revisions specific to yours. Make sure you do this from an updated (svn up) working directory.
Ater person A starts his screen-session with `screen`, person B can attach to the srceen of person A with `screen -x`. Good to know, if you need or give support from/to others.
If you use 'tail -f foo.txt' and it becomes temporarily moved/deleted (ie: log rolls over) then tail will not pick up on the new foo.txt and simply waits with no output.
'tail -F' allows you to follow the file by it's name, rather than a descriptor. If foo.txt disappears, tail will wait until the filename appears again and then continues tailing.
This lets you replace a file or directory and quickly revert if something goes wrong. For example, the current version of a website's files are in public_html. Put a new version of the site in public_html~ and execute the command. The names are swapped. If anything goes wrong, execute it again (up arrow or !!).
To monitor .vmdk files during snapshot deletion (commit) on ESX only (ESXi doesn't have the watch command):
1. Navigate to the VM directory containing .vmdk files.
# watch "ls -tough --full-time *.vmdk"
where:
-t sorts by modification time
-o do not list group information (to narrow the output)
-u sorts by access time
-g only here for the purpose to easily remember the created mnemonic word 'tough'
-h prints sizes in human readable format (e.g., 1K 234M 2G)
--full-time sets the time style to full-iso and does not list user information (to narrow the output)
optionally useful parameters to the watch command:
-d highlight changes between updates
-n seconds to wait between updates (default is 2)
-t turn off printing the header
Working with lists of IP addresses it is sometimes useful to summarize a count of how many times an IP address appears in the file.
This example, summarizeIP, uses another function "verifyIP" previously defined in commandlinefu.com to ensure only valid IP addresses get counted. The summary list is presented in count order starting with highest count.
I find this format easier to read if your going through lots of files. This way you can open the file in any editor and easily review the file
Sort lines within vi editor. In this example sort lines 33-61 and lines 4-9 asciibetically.