All commands (14,228)
-
Useful when you forget to use sudo for a command. "!!" grabs the last run command.
This is sample output - yours may be different.
· 2009-01-26 10:26:48 32
-
This is sample output - yours may be different.
python -m SimpleHTTPServer
-
Really useful for when you have a typo in a previous command. Also, arguments default to empty so if you accidentally run:
echo "no typozs"you can correct it with^zThis is sample output - yours may be different.
-
Next time you are using your shell, try typing ctrl-x e (that is holding control key press x and then e). The shell will take what you've written on the command line thus far and paste it into the editor specified by $EDITOR. Then you can edit at leisure using all the powerful macros and commands of vi, emacs, nano, or whatever. Show Sample Output
This is sample output - yours may be different.
GNU nano 2.0.7 File: /tmp/bash-fc-30782221326 # begin writing some exceedingly long and complex command in the editor...
-
When typing out long arguments, such as:
cp file.txt /var/www/wp-content/uploads/2009/03/You can put that argument on your command line by holding down the ALT key and pressing the period '.' or by pressing <ESC> then the period '.'. For example:cd 'ALT+.'would put '/var/www/wp-content/uploads/2009/03/ as my argument. Keeping pressing 'ALT+.' to cycle through arguments of your commands starting from most recent to oldest. This can save a ton of typing.This is sample output - yours may be different.
-
Particularly useful if you're mounting different drives, using the following command will allow you to see all the filesystems currently mounted on your computer and their respective specs with the added benefit of nice formatting. Show Sample Output
This is sample output - yours may be different.
/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro) tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755) /proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) varrun on /var/run type tmpfs (rw,nosuid,mode=0755) varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777) udev on /dev type tmpfs (rw,mode=0755) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620) fusectl on /sys/fs/fuse/connections type fusectl (rw) securityfs on /sys/kernel/security type securityfs (rw)
-
curl ifconfig.me/ip -> IP Adress curl ifconfig.me/host -> Remote Host curl ifconfig.me/ua ->User Agent curl ifconfig.me/port -> Port thonks to http://ifconfig.me/
This is sample output - yours may be different.
-
This is an alternative to cron which allows a one-off task to be scheduled for a certain time.
This is sample output - yours may be different.
echo "ls -l" | at midnight
-
This is sample output - yours may be different.
-
This will output the sound from your microphone port to the ssh target computer's speaker port. The sound quality is very bad, so you will hear a lot of hissing.
This is sample output - yours may be different.
dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp
-
Example :
vim /etc/fstab## damn<ctrl+u>sudo <ctrl+y>## like a boss. Example 2 :sudo vim /root/bin/##uh... autocomplete doesn't work...<ctrl+u>sudo ls /root/bin##ah! that's the name of the file!<ctrl+y> sudo vim /root/bin/ ##resume here! Thanks readline!This is sample output - yours may be different.
-
This is sample output - yours may be different.
sshfs name@server:/path/to/folder /path/to/mount/point
-
Query Wikipedia by issuing a DNS query for a TXT record. The TXT record will also include a short URL to the complete corresponding Wikipedia entry.You can also write a little shell script like:
$ cat wikisole.sh#!/bin/shdig +short txt ${1}.wp.dg.cxand run it like./wikisole.sh unixwere your first option ($1) will be used as search term. Show Sample OutputThis is sample output - yours may be different.
$ dig +short txt unix.wp.dg.cx "Unix (officially trademarked as UNIX, sometimes also written as Unix with small caps) is a computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe O" "ssanna. Today's Unix systems are split into various branches, developed over time by AT&T as well as various commercial... http://a.vu/w:Unix"
dig +short txt <keyword>.wp.dg.cx
-
Makes a partition in ram which is useful if you need a temporary working space as read/write access is fast. Be aware that anything saved in this partition will be gone after your computer is turned off.
This is sample output - yours may be different.
mount -t tmpfs tmpfs /mnt -o size=1024m
-
-p parameter tells wget to include all files, including images. -e robots=off you don't want wget to obey by the robots.txt file -U mozilla as your browsers identity. --random-wait to let wget chose a random number of seconds to wait, avoid get into black list. Other Useful wget Parameters: --limit-rate=20k limits the rate at which it downloads files. -b continues wget after logging out. -o $HOME/wget_log.txt logs the output
This is sample output - yours may be different.
wget --random-wait -r -p -e robots=off -U mozilla http://www.example.com
-
This is sample output - yours may be different.
-
Useful for checking if there are differences between local and remote files.
This is sample output - yours may be different.
ssh user@host cat /path/to/remotefile | diff /path/to/localfile -
-
time read -sn1 (s:silent, n:number of characters. Press any character to stop)
This is sample output - yours may be different.
time read (ctrl-d to stop)
-
Unreachable_host is unavailable from local network, but it's available from reachable_host's network. This command creates a connection to unreachable_host through "hidden" connection to reachable_host.
This is sample output - yours may be different.
ssh -t reachable_host ssh unreachable_host
-
This is sample output - yours may be different.
curl -u user:pass -d status="Tweeting from the shell" http://twitter.com/statuses/update.xml
-
A nice way to use the console in full screen without forget the current time. you can too add other infos like cpu and mem use. Show Sample Output
This is sample output - yours may be different.
Qui Fev 17 08:27:29 BRST 2011 #
while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-29));date;tput rc;done &
-
This is sample output - yours may be different.
-
Using +F will put less in follow mode. This works similar to 'tail -f'. To stop scrolling, use the interrupt. Then you'll get the normal benefits of less (scroll, etc.). Pressing SHIFT-F will resume the 'tailling'.
This is sample output - yours may be different.
-
This will output the characters at 10 per second.
This is sample output - yours may be different.
echo "You can simulate on-screen typing just like in the movies" | pv -qL 10
-
This is sample output - yours may be different.
- 1 2 3 > Last ›
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.
Check These Out
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }
History usually only gives the command number and the command. This will add a timestamp to the history file. Note: this will only put the correct timestamp on commands used after the export is done. You may want to put this in your .bashrc
In this example, file contains five columns where first column is text. Variance is calculated for columns 2 - 5 by using perl module Statistics::Descriptive. There are many more statistical functions available in the module.
This provides a way to sort output based on the length of the line, so that shorter lines appear before longer lines. It's an addon to the sort that I've wanted for years, sometimes it's very useful. Taken from my http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html
this function will give you a status webpage code using curl.
Much simpler method. More portable version: ssh host -l user "`cat cmd.txt`"
Uses vi style search / replace in bash to rename files. Works with regex's too (I use the following a script to fixup / shorten file names): # Remove complete parenthetical/bracket/brace phrases rename 's/\(.*\)//g' * rename 's/\[.*\]//g' * rename 's/\{.*\}//g' *