Using the COPYFILE_DISABLE=true environment variable you can prevent tar from adding any ._-files to your .tar-file on Mac OS X.
Finds the line number matching the regex, then passes that to BC for some math, passes that to head, and uses tail to trim off the unwanted section at the top. The whole thing is spit out to a script that can then be shared or run. Comes in handy for reading select sections from error logs.
This will be seen through your system's visual notification system, notify-osd, notification-daemon, etc. --- sleep accepts s,m,h,d and floats (date; sleep .25m; date) --- notify-send (-t is in milliseconds && -u low / normal / critical) man notify-send for more information --- notification-daemon can use b/i/u/a HTML
-P activates the Perl regular expression mode.
--format=x1 makes sure that 2 byte words do not get swapped to little-endian and that the output is exactly like the bytes are stored on disk. --address-radix=x makes sure offsets are not output in default octal base but in hex. --address-radix=n can also be used to only output data without offsets
If like me you do a lot of front-end coding and you have a lot of clients that asks you some little modifications, then you send the modifications back to them in a zip file while ignoring the .git folder and .gitignore file, then copy this zip into your dropbox and send it back to them. They find out a new bug so, rince and repeat? You get the picture. It can be quite tedious.
In a folder with many files and folders, you want to move all files where the date is >= the file olderFilesNameToMove and
This will show the amount of physical RAM that is left unused by the system. Show Sample Output
Combines wgzhao's grep | awk | sed into one awk command.
The biggest advantage over atoponce's nifty original is not killing the scrollback. Written assuming bash, but shouldn't be terribly difficult to port to other shells. S should be multiple spaces, but I can't get commandlinefu to save/show them properly, any help?
Filter output with default cvs update status (not only modified files 'M')
open [path] in the default program, regardless of which Desktop Environment you use (KDE, GNOME, etc.) Works on all "freedesktop.org" compatible desktop environments
Another step to bring cli and gui closer together: gnome-open
It opens a path with the default (gui) application for its mime type.
I would recommend a shorter alias like alias o=gnome-open
More examples:
gnome-open .
[opens the current folder in nautilus / your default file browser]
gnome-open some.pdf
[opens some.pdf in evince / your default pdf viewer]
gnome-open trash://
[opens the trash with nautilus]
gnome-open http://www.commandlinefu.com
[opens commandlinefu in your default webbrowser]
Show Sample Output
This function does a batch edition of all OOO3 Writer files in current directory. It uses sed to search a FOO pattern into body text of each file, then replace it to foo pattern (only the first match) . I did it because I've some hundreds of OOO3 Writer files where I did need to edit one word in each ones and open up each file in OOO3 gui wasn't an option. Usage: bsro3 FOO foo
documents all active ips on a subnet and saves to txt file. Show Sample Output
Control (stop, start, restart) a Windows Service from a Linux machine which has the `net` command (provided by samba). Show Sample Output
A Quick variation to the latest commands list with the new-lines skipped. This is faster to read.
I use this sometimes when ctags won't help.
USAGE: $ sudor your command
This command uses a dirty hack with history, so be sure you not turned it off.
WARNING!
This command behavior differ from other commands. It more like text macro, so you shouldn't use it in subshells, non-interactive sessions, other functions/aliases and so on. You shouldn't pipe into sudor (any string that prefixes sudor will be removed), but if you really want, use this commands:
proceed_sudo () { sudor_command="`HISTTIMEFORMAT=\"\" history 1 | sed -r -e 's/^.*?sudor//' -e 's/\"/\\\"/g'`" ; pre_sudor_command="`history 1 | cut -d ' ' -f 5- | sed -r -e 's/sudor.*$//' -e 's/\"/\\\"/g'`"; if [ -n "${pre_sudor_command/ */}" ] ; then eval "${pre_sudor_command%| *}" | sudo sh -c "$sudor_command"; else sudo sh -c "$sudor_command" ;fi ;}; alias sudor="proceed_sudo # "
The following command finds all the files not modified in the last 5 days under /protocollo/paflow directory and creates an archive files under /var/dump-protocollo in the format of ddmmyyyy_archive.tar
Please be careful while executing the following command as you don?t want to delete the files by mistake. The best practice is to execute the same command with ls ?l to make sure you know which files will get deleted when you execute the command with rm.
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: