commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Use this command to execute the contents of http://www.example.com/automation/remotescript.sh in the local environment. The parameters are optional.
Alterrnatives to wget:
curl -s http://www.example.com/automation/remotescript.sh | bash /dev/stdin param1 param2
w3m -dump http://www.example.com/automation/remotescript.sh | bash /dev/stdin [param1] [param2]
lynx -source http://www.example.com/automation/remotescript.sh | bash /dev/stdin [param1] [param2]
While `sshfs $REMOTE_HOST:$REMOTE_PATH $LOCAL_PATH` "pulls" a directory from the remote server to the local host, the above command does the reverse and "pushes" a directory from the local host to the remote server.
This makes use of the "slave" option of sshfs which instructs it to communicate over plain stdin/stdout and the `dpipe` tool from vde2 to connect the sftp-server stdout to the sshfs stdin and vice-versa.
You can use it to connect to remote windows machine and start some scritps that need user login
Place in .bash_profile
Run this within a steady screen session.
You can get the approximate time when the remote server went down or other abnormal behavior.
this way you have the multitail with all its options running on your own machine with the tails of the two remote machines inside :)
Great way to quickly grasp if a locally cloned repository originates from e.g. github or elsewhere.
attempts to delete all local branches. git will fail on any branches not fully merged into local master, so don't worry about losing work. git will return the names of any successfully deleted branches. Find those in the output with grep, then push null repositories to the corresponding names to your target remote.
- your local and remote branches are identically named, and there's nothing extra in the remote branch that you still want
- EDIT: you want to keep your local master branch
- Where $URL is the URL of the file.
- Replace the $2 by $3 at the end to get a human-readable size.
Credits to svanberg @ ArchLinux forums for original idea.
Edit: Replaced command with better version by FRUiT. (removed unnecessary grep)
If you need to xdebug a remote php application, which is behind a firewall, and you have an ssh daemon running on that machine. you can redirect port 9000 on that machine over to your local machine from which you run your xdebug client (I am using phpStorm)
So, run this command on your local machine and start your local xdebug client, to start debugging.
The `export` is unnecessary if it's only applicable to the one command.
Like the given command, but combines _DISPLAY=":0.0"_ with _export DISPLAY_ to get _export DISPLAY=":0.0"_ and only imports if DISPLAY is set successfully.
You can use
vim scp:[email protected]//file
too in a simple case.
If you have lots of remote hosts sitting "behind" an ssh proxy host, then there is a special-case use of "rsynch" that allows one to easily copy directories and files across the ssh proxy host, without having to do two explicit copies: the '-e' option allows for a replacement "rsh" command. We use this option to specify an "ssh" tunnel command, with the '-A' option that causes authentication agent requests to be forwarded back to the local host. If you have ssh set up correctly, the above command can be done without any passwords being entered.