Useful if a different user cannot access some directory and you want to know which directory on the way misses the x bit. Show Sample Output
The original didn't use -print0 which fails on weird file names eg with spaces. The original parsed the output of 'ls -l' which is always a bad idea.
This will search all directories and ignore the CVS ones. Then it will search all files in the resulting directories and act on them.
this will tar/send/untrar a whole directory.
For use in scripts this command is very usefull
The command gives size of all files smaller than 1024k, this information, together with disk usage, can help determin file system parameter (e.g. block size) or storage device (e.g. SSD v.s. HDD). Note if you use awk instead of "cut| dc", you easily breach maximum allowed number of records in awk. Show Sample Output
A lot of files in one dir is not so cool for filesystem.
The `*.csv` type can be substituted for anything you want Show Sample Output
I use this on Debian to rename files that exist in directories but do not have the year in the file name. The directory has the year but the files inside don't. How I explain how this runs: The dir variable grabs the name of the folder. Using rename, substitute the name of the first file and remove the extension, then rename it to the directory name. To test this before you run it, change -v to -vn. Show Sample Output
Unblock multiple windows files using Powershell. -Recurse is optional to apply to all directories recursively.
I needed to get a feel for how "old" different websites were, based on their directories. Show Sample Output
This may seem like a long command, but it is great for making sure all file permissions are kept in tact. What it is doing is streaming the files in a sub-shell and then untarring them in the target directory. Please note that the -z command should not be used for local files and no perfomance increase will be visible as overhead processing (CPU) will be evident, and will slow down the copy.
You also may keep simple with, but you don't have the progress info:
cp -rpf /some/directory /other/path
Show Sample Output
Broaden your knowledge of the utilities available to you in no particular order whatsoever! Then use that knowledge to create more nifty one-liners that you can post here. =p Takes a random number modulo the number of files in $dir, prints the filename corresponding to that number, and passes it as an argument to man.
This command defragment the SQLite databases found in the home folder of the current Windows user.
This is usefull to speed up Firefox startup.
The executable sqlite3.exe must be located in PATH or in the current folder.
In a script use:
for /f "delims==" %%a in (' dir "%USERPROFILE%\*.sqlite" /s/b ') do echo vacuum;|"sqlite3.exe" "%%a"
Show Sample Output
there is no explicit find command in DOS you can create a batch file with this one and find all jpegs on the C drive ...
note: if creating a batch file "find.bat" the syntax changes to:
for %%f in (c) do dir %%f:\%1 /s /p
you can then use
find *.jpg
Show Sample Output
You can redirect the pipe to > file.txt See more here: http://ss64.com/nt/dir.html
Sometimes you want to know the summary of the sizes of directories without seeing the details in their subdirectories. Especially if it is going to just scroll off the screen. This one liner summarizes the disk usage of any number of directories in a directory without giving all the details of whats happening underneath. 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: