If you are on machine 1 and want to ssh into machine 3, but you can only do so from machine 2, this will do it all in one go. Note that once you are on machine 3 and exit () it will take you directly back to machine 1
grep -v '\(/dev/\|pipe:\|socket:\)' seemingly looks a bit complicated. This can, of course, be replaced by head -1. However, it is not sure whether the filename line will be first on all systems, so I chose the safer way by filtering out what is not needed here. Show Sample Output
On debian parent process is running as root, workers as www-data. You can run strace in backgroud, get its PID, curl your webpage, kill strace and read your stats.
Won't work with password login. You must add your RSA key to the server's authorizedkeys file, or change the ssh command adding the -i option for a custom RSA key:
socat "UNIX-LISTEN:/tmp/mysqld.temp.sock,reuseaddr,fork" EXEC:"ssh username@remoteserver.com -i /home/user/rsa-keys/id_rsa socat STDIO UNIX-CONNECT\:/var/run/mysqld/mysqld.sock"
---
/tmp/mysqld.temp.sock will be created locally by socat, don't create it yourself. The folder it lives must be writable. Connect your MySQL client to this socket, with database and username set properly.
---
In case you need to forward a remote socket to a LOCAL PORT instead, check http://www.commandlinefu.com/commands/view/9436/socat-tcp-listen5500-execssh-userremotehost-socat-stdio-unix-connectvarrunmysqldmysqld.sock
Docker's local man pages are (often) half of what you have online, so I wanted that as local man. Install lynx and run my oneliner, then use as follows: dockpage Adjust lynx's page width at will Show Sample Output
Requirements: ffmpeg2theora (http://v2v.cc/~j/ffmpeg2theora/)
adding users to groups on OS X is not a straightforward process, you need to use the new in built in Directory Service command line utility...
Let's supose some moron used some m$ shit to commit to a later svnsynced repo. On a svn sync all his message logs cause a svnsync: Error setting property 'log': this commands finds all its contributions and fix all his commit logs Show Sample Output
since awk was already there one can use it instead of the 2 greps. might not be faster, but fast enough
this is the much easier zsh equivalent ...
This command will enable dns spoofing through ettercap. The etter.dns config file must be set. The -i parameter defines the interface, e.g. eth0, eth1, wlan0... ettercap -h for more info Credit goes to xhabie-crew
This was done in csh. Show Sample Output
Generates a qr Code from a textfile and saves the code as png. Works with any ASCII file (obviously)
Converts red-cyan 3D anaglyphs to side-by-side format viewable by crossing your eyes. Useful for people who don't have 3D glasses or prefer not to use one.
Using PHP shell to URL decode a string. Show Sample Output
Note that in the command N is, for instance, 37. Show Sample Output
If you have a series of existing files in a directory that you would like to copy to a new series, and then make a series of changes to those new files, this will speed up the process of copying the files. You can later iterate through a loop and use sed -i -e 's/old_string/new-string' new_string_files.* to replace all the values you need to in the newly copied files. Show Sample Output
If you want to search for all symlinks in current directory AND its subdirectories, make sure you omit the "-maxdepth 1" bit. Also, modify regextype as desired. I DO prefer to AVOID the use of extended regexp whenever possible, because this will usually only give correct results if you use GNU find. Hack a line containing ext-regexp into an HP-UX workstation, and you're in trouble.
I just needed to store the LAN IP (for ipv4) in a variable for a specific task in a bash script. I figured I'd share. I sent it to a variable with VAR=$(stuff) and used it later on. I put the exit 0 in the if statement to make it so that it breaks if there are more than one IPv4 addresses assigned. I only wanted the first one. Edit: Bear in mind, my network mask is a double digit number so if you have a smaller nw mask you'd need to edit the sed statement. 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: