Commands using alias (221)

  • I realise that this is just a reiteration of another entry (regardless of whether I came up with all this all by myself), but I would like present my additional alias' in context as a method of managing your directories. Rather convenient.


    0
    alias md='mkdir -p'; alias rd='rmdir'; mcd () { mkdir "$@" && cd "$_"; }
    expelledboy · 2012-08-12 12:54:51 0
  • This was me just succumbing to the habits, but now I rarely use quit or vim directly, so beware! :)


    -3
    alias ':q'='exit'; alias ':e'='vim';
    expelledboy · 2012-08-12 12:35:10 0
  • NAME sprunge: command line pastebin: SYNOPSIS | curl -F 'sprunge= DESCRIPTION add ? to resulting url for line numbers and syntax highlighting EXAMPLES ~$ cat bin/ching | curl -F 'sprunge= http://sprunge.us/VZiY ~$ firefox http://sprunge.us/VZiY?py#n-7 SEE ALSO http://github.com/rupa/sprunge Show Sample Output


    2
    alias pasteit="curl -F 'sprunge=<-' http://sprunge.us"
    frdmn · 2012-07-19 19:46:39 0

  • -3
    alias myip='curl -s http://checkrealip.com/ | grep "Current IP Address"'
    levenbrech · 2012-07-17 23:08:49 0
  • use vim like less command pager but with color highlighting = pretty :p also u can use /usr/share/vim/vim73/macros/less.sh


    7
    alias vless='/usr/share/vim/vimcurrent/macros/less.sh'
    Bonster · 2012-04-28 23:01:25 1
  • Put this in your bash startup script so you can quickly remember the top rated commands on CommandLineFu's website. Put it in .bashrc on Linux, or .bash_profile on OSX. Show Sample Output


    0
    alias fu='curl -s http://www.commandlinefu.com/commands/browse/sort-by-votes/plaintext | grep -vE "^$|^#"'
    kordless · 2012-04-16 05:53:56 0
  • strips html from stdin Show Sample Output


    2
    alias html2ascii='lynx -force_html -stdin -dump -nolist'
    oernii2 · 2012-04-12 14:02:44 0
  • Alias a single character 'b' to move to parent directory. Put it into your .bashrc or .profile file. Using "cd .." is one of the most repetitive sequence of characters you'll in the command line. Bring it down to two keys 'b' and 'enter'. It stands for "back" Also useful to have multiple: alias b='cd ../' alias bb='cd ../../' alias bbb='cd ../../../' alias bbbb='cd ../../../../' Show Sample Output


    1
    alias b='cd ../'
    deshawnbw · 2012-04-01 06:04:45 1

  • 1
    alias man='man -S 2:3:1'
    kev · 2012-03-29 12:02:47 2
  • Run the alias command, then issue ps aux | tail and resize your terminal window (putty/console/hyperterm/xterm/etc) then issue the same command and you'll understand. ${LINES:-`tput lines 2>/dev/null||echo -n 12`} Insructs the shell that if LINES is not set or null to use the output from `tput lines` ( ncurses based terminal access ) to get the number of lines in your terminal. But furthermore, in case that doesn't work either, it will default to using the default of 80. The default for TAIL is to output the last 10 lines, this alias changes the default to output the last x lines instead, where x is the number of lines currently displayed on your terminal - 7. The -7 is there so that the top line displayed is the command you ran that used TAIL, ie the prompt. Depending on whether your PS1 and/or PROMPT_COMMAND output more than 1 line (mine is 3) you will want to increase from -2. So with my prompt being the following, I need -7, or - 5 if I only want to display the commandline at the top. ( http://www.askapache.com/linux/bash-power-prompt.html ) 275MB/748MB [7995:7993 - 0:186] 06:26:49 Thu Apr 08 [askapache@n1-backbone5:/dev/pts/0 +1] ~ In most shells the LINES variable is created automatically at login and updated when the terminal is resized (28 linux, 23/20 others for SIGWINCH) to contain the number of vertical lines that can fit in your terminal window. Because the alias doesn't hard-code the current LINES but relys on the $LINES variable, this is a dynamic alias that will always work on a tty device. Show Sample Output


    2
    alias tail='tail -n $((${LINES:-`tput lines 2>/dev/null||echo -n 80`} - 7))'
    AskApache · 2012-03-22 02:44:11 2
  • Changes machine and cd to specific directory Add to .*shrc Usage : sshto


    0
    alias sshto 'ssh -X -t \!:1 "cd \!:2 ; tcsh"'
    pranavkn · 2012-03-20 20:07:37 0
  • If you want to carry on your aliases while using sudo, put this into a file which will be parsed when logging in. Show Sample Output


    0
    alias sudo='sudo '
    Testuser_01 · 2012-03-04 20:02:38 0
  • sort is way slow by default. This tells sort to use a buffer equal to half of the available free memory. It also will use multiple process for the sort equal to the number of cpus on your machine (if greater than 1). For me, it is magnitudes faster. If you put this in your bash_profile or startup file, it will be set correctly when bash is started. sort -S1 --parallel=2 <(echo) &>/dev/null && alias sortfast='sort -S$(($(sed '\''/MemF/!d;s/[^0-9]*//g'\'' /proc/meminfo)/2048)) $([ `nproc` -gt 1 ]&&echo -n --parallel=`nproc`)' Alternative echo|sort -S10M --parallel=2 &>/dev/null && alias sortfast="command sort -S$(($(sed '/MemT/!d;s/[^0-9]*//g' /proc/meminfo)/1024-200)) --parallel=$(($(command grep -c ^proc /proc/cpuinfo)*2))" Show Sample Output


    3
    alias sortfast='sort -S$(($(sed '\''/MemF/!d;s/[^0-9]*//g'\'' /proc/meminfo)/2048)) $([ `nproc` -gt 1 ]&&echo -n --parallel=`nproc`)'
    AskApache · 2012-02-28 01:34:58 3
  • To prevent accidental deleting of files you can disable rm with this alias. Then use the trash command from trash-cli instead.


    0
    alias rm='echo "rm is disabled, use trash or /bin/rm instead."'
    captaincomic · 2012-01-27 03:11:45 0
  • The command creates an alias called 'path', so it's useful to add it to your .profile or .bash_profile. The path command then prints the full path of any file, directory, or list of files given. Soft links will be resolved to their true location. This is especially useful if you use scp often to copy files across systems. Now rather then using pwd to get a directory, and then doing a separate cut and paste to get a file's name, you can just type 'path file' and get the full path in one operation. Show Sample Output


    1
    alias path="/usr/bin/perl -e 'use Cwd; foreach my \$file (@ARGV) {print Cwd::abs_path(\$file) .\"\n\" if(-e \$file);}'"
    espider1 · 2012-01-18 01:40:05 1
  • use xdg-open without looking at error messages examples msg: (nautilus:3955): Gtk-WARNING **: Theme parsing error: Notebook.css:21:15: Junk at end of value


    -3
    alias o='xdg-open "$@" 2>/dev/null'
    Bonster · 2011-12-26 08:52:22 2
  • Alias to play flash videos with mplayer. You can replace mplayer with your favorite video player. This alias supports Chrome & Firefox's way of handling the flash plugin. It will play all the videos in the cache. Note that certain videos might never make it to the cache, if the publisher ask for them not to: they will just be loaded in RAM. A variant if you're just interested in playing the audio, for example for a music : alias flashmusic="mplayer -vo null \$(find /proc/\$(pgrep -f 'libgcfl|libflashplayer')/fd/ -printf '%p %l\n' |grep FlashXX | cut -d\ -f1)"


    0
    alias flashplay="mplayer \$(find /proc/\$(pgrep -f 'libgcflash|libflashplayer')/fd/ -printf '%p %l\n' |grep FlashXX | cut -d\ -f1)"
    Aissen · 2011-12-19 09:29:57 0
  • requires a gmail account, it opens Google tasks in a self contain window, to write your todo list and have it sync online yay =)


    -4
    alias gtasks='chromium-browser --app=https://mail.google.com/tasks/ig'
    Bonster · 2011-12-05 22:11:00 0
  • Syntax outside of an alias would be printf %b \\033c. This clears the screen and removes scrollback. Works on gnome-terminal and the XFCE's Terminal, and XTerm. It does clear the screen in Konsole and the Mac Terminal, but does not clear scrollback.


    0
    alias cls='printf %b '\''\033c'\'''
    robinsonaarond · 2011-11-01 14:31:30 0
  • Uses printf command to resize terminal. So far, this is tested to NOT work in Konsole. Works with Mac Terminal, XFCE Terminal, XTerm, gnome-terminal.


    0
    alias mid='printf "\e[8;24;80;t"'
    robinsonaarond · 2011-11-01 14:25:45 0
  • Creates an alias that reports your hostname and IP for you computer. Getting the quotes in an alias with awk commands can be a painful. Need uname and ifconfig--both are included in most unix distributions, I believe. Hope it is useful. Show Sample Output


    0
    alias me="echo '`ifconfig | grep inet | grep broadcast | awk '{print $2}'`' && uname -n"
    timrand · 2011-10-30 19:36:42 1

  • -21
    alias ..='cd ..'
    kev · 2011-10-28 10:12:57 8
  • I put this line in my ~/.bashrc file (which I source via ~/.bash_profile). Now, when I need to install a package, I typed *install* instead of the longer version.


    -6
    alias install='sudo apt-get install'
    haivu · 2011-10-27 19:53:01 9
  • use python as calculator, press ctrl+d to exit reminder: when doing factions add atleast one decimal number like so 22.0/7 or 22/7.0 Show Sample Output


    0
    alias calc='python -ic "from math import *; from random import *"'
    Bonster · 2011-10-24 08:15:41 0
  • Prints out the list of date(1) format codes, for quick easy reference. dateformatcodes Show Sample Output


    0
    alias dateformatcodes="date --help | sed -n '/^FORMAT/,/%Z/p'"
    defiantredpill · 2011-10-20 17:43:36 0
  •  < 1 2 3 4 5 >  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.

Share Your Commands


Check These Out

Converts uppercase chars in a string to lowercase
Another alternative is to define a function: lower() { echo ${@,,} } lower StrinG

auto terminal title change
above line in .bash_profile will give you window title in putty or terminal client when you login to your remote server

Run a command, store the output in a pastebin on the internet and place the URL on the xclipboard
The URL can then be pasted with a middle click. This is probably useful when trying to explain problems over instant messaging when you don't have some sort of shared desktop.

Pipe the result of a command to IRC (channel or query)
$ command | my_irc Pipe whatever you want to this function, it will, if everything goes well, be redirected to a channel or a user on an IRC server. Please note that : - I am not responsible of flood excesses you might provoke. - that function does not reply to PINGs from the server. That's the reason why I first write in a temporary file. Indeed, I don't want to wait for inputs while being connected to the server. However, according to the configuration of the server and the length of your file, you may timeout before finishing. - Concerning the server, the variable content must be on the form "irc.server.org 6667" (or any other port). If you want to make some tests, you can also create a fake IRC server on "localhost 55555" by using $ netcat -l -p 55555 - Concerning the target, you can choose a channel (beginning with a '#' like "#chan") or a user (like "user") - The other variables have obvious names.

Remove security limitations from PDF documents using ghostscript
Remove security from PDF document using this very simple command on Linux and OSX. You need ghostscript for this baby to work.

Search and play youtube videos directly to terminal (no X needed)
Same as other command, however uses youtube-dl internal search (thanks to qoxxxx mentioning this) It does however seem to be a little buggy and youtube-dl crashes sometimes. ## pyt 'Stairway to heaven - Led Zeppelin' pyt 'brain damage - Pink Floyd' No web browser or even X needed. Just a cli and internet connection! mplayer is pauseable and can skip ahead This may break if youtube changes their search html.

create tar archive of files in a directory and its sub-directories
creates a compressed tar archive of files in /path/foo and writes to a timestamped filename in /path.

add the result of a command into vi
':r!ls -l' results in listing the files in the current directory and paste it into vi

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Convert .wma files to .ogg with ffmpeg


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: