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.
» 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:
exec -a $NAME $COMMAND $ARGS
`your_cmd -erase_all_files` is the real process, but harmless-looking getty appears in the process table.
Never actually had a need to do this, but interesting nonetheless... Tested in bash, dash.
-a $NAME
"pass NAME as the zeroth argument to COMMAND", i.e. customise the name of the process (as commonly seen with `ps`)
Takes all the .3gp files in the directory, rotates them by 90 degrees, and saves them in the lossless ffv1 encoding.
If this rotates in the wrong direction, you may want transponse=1
Re-encoding to ffv1 may result in a significant increase in file size, as it is a lossless format. Other applications may not recognize ffv1 if they don't use ffmpeg code. "huffyuv" might be another option for lossless saving of your transformations.
The audio may be re-encoded as well, if the encoding used by your 3gp file doesn't work in a avi container.
How to extract data from one table:
mysqldump --opt --where="true LIMIT 5000" dbinproduzione tabella > miodbditest_tabella.sql
The command tasksel allows the choice of packages from the command line to get predefined configurations for specific services (usually this option is offered during installation).
Finally, we can make the file "unchangeable"
sudo chattr +i
Cleaner with a mailto assignment in crontab (if the command fails you get an email):
MAILTO=admin@example.com
10,30,50 * * * * ping -q -c1 -w3 192.168.0.14 >/dev/null
Delete all comments (#) on text :
It deletes the entire comment line and remove comments form end of others.
Use it with cat and '|' for know what is used in a conf file.
For example cat /etc/squid/squid.conf | sed -re '/^#/d ; s/#.*$// ; /^\s$/d' :
Show you what you use in your file conf.
It removes all comments and empty lines.
Empty lines are lines with nothing, a tab, or a space.
It remove the square bracket and convert UNIX time to human readable time for all line of a stream (or file).
first need to Edit the configuration file
/home/cicciobomba/.subversion
and under the [tunnels] add this line
ciccio_diverso = /usr/bin/ssh -p 12345
But if you use a screen saver, you must first disable your screen saver
kill $(ps ax | grep screensaver | grep -v grep | awk '{ print $1 }')
Print out the progress of MySQL import using the pv command. Updates every second.
To allow a program ("programmaautorizzato" in example) to listen through the firewall
The crypt function takes a password, key, as a string, and a salt character array which is described below, and returns a printable ASCII string which starts with another salt. It is believed that, given the output of the function, the best way to find a key that will produce that output is to guess values of key until the original value of key is found.
Works by trimming digits from the GNU version of Date's nano-second output.
From Date man page:
( %N nanoseconds (000000000..999999999)
python -c "DEV = '/dev/input/event4'
#if event0 doesn't work, try event1 event2 etc
fo = open(DEV)
def interpret(keycode,state):
if state == 0:
print '%i up'%keycode
if state == 1:
print '%i down'%keycode
if state == 2:
print '%i repeat'%keycode
while 1:
line = fo.read(16)
if ord(line[10]) != 0:
keycode,state = line[10],line[12]
interpret(ord(keycode),ord(state))
"
The tag function takes a tag name as its first argument, then a list of files which take that tag. The directory $HOME/tags/tagname will then hold symbolic links to each of the tagged files. This function was inspired by tmsu (found at https://bitbucket.org/oniony/tmsu/wiki/Home).
Example:
tag dog airedale.txt .shizturc weimeraner.pl
This will create $HOME/tags/dog which contains symbolic links to airedale.txt .shizturc and weimeraner.pl
--vrdp on enables VirtualBox RDP server for the VM
--vrdpport 3389 ndicates the TCP port that the server will accept RDP connections direct to the VM (for each VM is assigned a different port)
--vrdpauthtype external RDP console gives access to the VM Host physical users via authentication
In fact, in the 3.1.x version of VirtualBox, the external value for the parameter --vrdpauthtype allows access via RDP only to the user who started the VM.
The workaround is to add the user that runs the VM to shadow group, using the command