Commands by Jessehz (1)

  • Join all sequentially named files in the directory. Use this for files split by utilities like hjsplit and similar. This command does not do/perform _any_ sanity checks before acting, except that it won't run unless there is a file that matches "*.001". - The outfile should not already exist. - There should be more than one file. (*.002 should exist as well as *.001) - The file-count should match the number in the name of the last file in the series. - None of the files should be empty. - All files should be the same size, except for the last, which should usually be smaller, but never larger than the rest. A safer altenative can be found here: http://pastebin.com/KSS0zU2F


    0
    x=(*.001); cat "${x%.001}."* > "${x%.001}" #unsafe; does not check that all the parts are there, or that the file-sizes make sense!
    Jessehz · 2011-08-24 04:10:20 4

What's this?

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.

Share Your Commands


Check These Out

Find chronological errors or bad timestamps in a Subversion repository
Lists revisions in a Subversion repository with a timestamp that doesn't follow the revision numbering order. If everything is OK, nothing is displayed.

Read and write to TCP or UDP sockets with common bash tools
Ever needed to test firewalls but didn't have netcat, telnet or even FTP? Enter /dev/tcp, your new best friend. /dev/tcp/(hostname)/(port) is a bash builtin that bash can use to open connections to TCP and UDP ports. This one-liner opens a connection on a port to a server and lets you read and write to it from the terminal. How it works: First, exec sets up a redirect for /dev/tcp/$server/$port to file descriptor 5. Then, as per some excellent feedback from @flatcap, we launch a redirect from file descriptor 5 to STDOUT and send that to the background (which is what causes the PID to be printed when the commands are run), and then redirect STDIN to file descriptor 5 with the second cat. Finally, when the second cat dies (the connection is closed), we clean up the file descriptor with 'exec 5>&-'. It can be used to test FTP, HTTP, NTP, or can connect to netcat listening on a port (makes for a simple chat client!) Replace /tcp/ with /udp/ to use UDP instead.

show current directory
Opens a file or URL in the user's preferred application.

List process in unkillable state D (iowait)

Stripping ^M at end of each line for files
That "^M" is Ctrl-M, which is a carriage return, and is not needed in Unix file systems. Where ^V is actually Ctrl-V and ^M is actually Ctrl-M (you must type these yourself, don't just copy and paste this command). ^V will not be displayed on your screen.

add a ip address to a network device
Allows to add more than one ip address to one network device.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Obtain last stock quote from google API with xmlstarlet

check open ports without netstat or lsof

Upload a video to youtube
Google just released a new commend line tool offering all sorts of new services from the commend line. One of them is uploading a youtube video but there are plenty more google services to interact with. Download it here: http://code.google.com/p/googlecl/ Manual: http://code.google.com/p/googlecl/wiki/Manual


Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: