Use xargs command to make one line.
Useful command for MySQL Show Sample Output
queries related to table 'Invoice_template' Show Sample Output
If you have two sets of files that may share hard-linked files, it can be useful to identify which ones are hard links to same underlying inode (file). This command shows you all of those, sorted by inode#. In my example the two directory trees to compare share a common parent, so I run the command in that parent and just use
find .
to start from the current directory. If yours are in different locations, you can pass both paths to find:
find /directory1 /directory2 -type f -printf '%10i %p\n' | sort | uniq -w 11 -d -D | less
Show Sample Output
Alternatively, the kernel provides a script to cleanly compare two config files even if the options have moved in the file itself: /usr/src/linux/scripts/diffconfig .config.old .config
Very useful for finding the largest files and subdirectories at any given point. Any user can run it from current location just when need to know their largest files and subtdirectories from a certain point down as well. Show Sample Output
This commands will make it easier to select only common items between two files being compared. If your lines start with things other than lowercase a-z, adjust this Regex appropriately. Number of lines in the output has been set to no more than 10000, and should be adjusted as needed.
You can replace "sort -nu" with "sort -u" for a word list sorted or "sort -R" for a random-sorted line (edit: corrected) Show Sample Output
This command will generate "CHECK TABLE `db_name.table_name` ;" statements for all tables present in databases on a MySQL server, which can be piped into the mysql command. (Can also be altered to perform OPTIMIZE and REPAIR functions.) Tested on MySQL 4.x and 5.x systems in a Linux environment under bash. Show Sample Output
search argument in PATH accept grep expressions without args, list all binaries found in PATH Show Sample Output
You'll run into trouble if you have files w/ missing newlines at the end. I tried to use
PAGER='sed \$q' git blame
and even
PAGER='sed \$q' git -p blame
to force a newline at the end, but as soon as the output is redirected, git seems to ignore the pager.
Thanks for the submit! My alternative produces summaries only for directories. The original post additionally lists all files in the current directory. Sometimes the files, they just clutter up the output. Once the big directory is located, *then* worry about which file(s) are consuming so much space.
first 10 big file
1.) my profile ends with $USER not with .default 2.) only grep for the first occurrence because some extensions have the translated name also inside the install.rdf Show Sample Output
with grep for em:name rather than name, you will get much better result. Show Sample Output
print members both in file1 and file2
This alternative cleans HISTTIMEFORMAT environment variable and calls gnuplot just after /tmp/cmds is closed, to avoid some errors.
This command allows you to find the effective uid and gid of the Apache process regardless of process name (which can be apache2 or httpd depending on distro).
So your boss wants to know how much memory has been assigned to each virtual machine running on your server... here's how to nab that information from the command line while logged in to that server Show Sample Output
Show the top file size in human readable form
% lsof -v lsof version information: revision: 4.78
Deletes capistrano-style release directories (except that there are dashes between the YYYY-MM-DD) 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: