Use the command to create a script and bind it to a key using keyboard shortcut. eg: Script locks the screen in a loop until the command is executed again.At first it
This lists all files modified after calling some command using a temporal anchor.
retrieve file names back from touch commands for them Show Sample Output
...changes modify time and access time. also: touch -r [file1] [file2] # make file2 timestamp match file1
Thanks th John_W for suggesting the fix allowing ~/ to be used when saving a directory. directions: Type in a url, it will show a preview of what the file will look like when saved, then asks if you want to save the preview and where you want to save it. Great for grabbing the latest commandlinefu commands without a full web browser or even a GUI. Requires: w3m Show Sample Output
creates 100 directories f(1-100) with a file in each matched to the directory (/f1/myfile1, .. /f98/myfile98,/f99/myfile99/,/f100/myfile100,etc ) Show Sample Output
Change file time stamp
You could avoid xargs and sed in this case (shorter command and less forking): At least bash and zsh have some mighty string modifiers. I would also suggest using find with exec option to get more flexibility. You may leave out or include "special" file for example.
I simply find binary notation more straightforward to use than octal in this case. Obviously it is overkill if you just 600 or 700 all of your files... Show Sample Output
Modify all files newer than another file and touch them to a specific date. Show Sample Output
touch -t 201208211200 first ; touch -t 201208220100 last ; creates 2 files: first & last, with timestamps that the find command should look between: 201208211200 = 2012-08-21 12:00 201208220100 = 2012-08-22 01:00 then we run find command with "-newer" switch, that finds by comparing timestamp against a reference file: find /path/to/files/ -newer first ! -newer last meaning: find any files in /path/to/files that are newer than file "first" and not newer than file "last" pipe the output of this find command through xargs to a move command: | xargs -ifile mv -fv file /path/to/destination/ and finally, remove the reference files we created for this operation: rm first; rm last;
Copies file to a temporary location, edit and set to real file's time stamp then copy back. Assumes access to /tmp and has $EDITOR, but can be replaced with better values.
make a bunch of files with the same permissions, owner, group, and content as a template file (handy if you have much to do w. .php, .html files or alike)
Requires GNU touch. If on OSX, install coreutils and s/touch/gtouch/.
For OS X/bsd; probably messy
When run on an existing file, alters it's creation date.
This runs a command continuously, restarting it if it exits. Sort of a poor man's daemontools. Useful for running servers from the command line instead of inittab.
Sometimes you just want to operate on files that were created after specific date. This command consists of 3 commands: - Create a dummy file with the custom date - Find all files with "creation time" further than our custom date by using `-newer` find option. Add your crazy stuff here, like moving, deleting, printing, etc. - Remove the dummy file Show Sample Output
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: