What are your favored command line attributes or methods?

Share your command line attributes and also methods for Unix/Linux. Attempt to maintain it shell/distro agnostic when possible. Fascinated in seeing pen names, one-liners, key-board faster ways, tiny shell manuscripts, and so on

0
2019-05-04 19:30:25
Source Share
Answers: 60

Summarize directory site dimension, with coming down human dimension

du -hs */ | sort -hr

as an example

10.2G   foo/
4M      bar/
0
2019-12-04 05:30:18
Source

I locate recognizing bash key strokes brings about extra reliable shelling, which a great deal of them are right from emacs clarifies their use (i.e. that meta-XXX is the large bro variation of ctrl-XXX command generally).

The "meta" key is generally the "alt" key, yet can additionally be "esc" key. as an example meta-f can be obtained with either alt-f or esc f.

For the alt - key mappings to function, you might need to unset "menu accessibility keys" or its equal in the console alternatives. Primarily if you push alt - f and also get the documents food selection punctual, switch off the alt - key accessibility food selections.

ctrl-a / ctrl-e : move to start / end of line essentials you can not do without

ctrl-f, meta-f : forward char/word pushing alt - f leaps you onward "1 word" which on command line is virtually a command or argument

ctrl-b, meta-b : backwards char/word like alt - f, yet in reverse to leap in reverse via the command line

ctrl-d, meta-d : delete char/word pushing alt - d will certainly delete (to end of) existing word under arrow. a lot quicker after that holding delete down for 30 secs. Valuable when you are tab finishing in the center of something and also intend to onward delete throughout of word.

ctrl-k : kill line deletes throughout of line

ctrl-u : undo as an example keying a password, and also you recognize you've obtained it incorrect someplace, as opposed to striking backspace 20 times, simply struck ctrl - u. additionally gets rid of the existing command line.

meta-# : insert comment this is wonderful for maintaining your command line you are accumulating as a comment prior to running it if you require to do another thing first. it will certainly enter into your command background yet not run.

ctrl-r : reverse search looking in reverse via your shell background (duplicated ctrl - r for next suit)

ctrl-g : abort if you remain in center of ctrl-r and also intend to simply return to where you were keying, simply terminate your search with ctrl-g

meta-space / ctrl-x ctrl-x : set mark and jump to mark if you require to promptly leap to a placement in your command line, first set the mark, after that leap back to it with ctrl-x ctrl-x. Note you might need to make use of esc-space to get the mark set as alt-space is usually bound to lowering the console food selection.

ctrl-] <char> : quick jump to <char> leaps onward to the personality keyed in after the ctrl-] on command line. The large bro Meta-ctrl-] <char> leaps in reverse.

0
2019-12-04 05:29:12
Source

binary star development with zsh (which recursively comes down the directory site tree, not simply one degree, something comparable to $(find ! -type d) :

grep string **/*.cc
0
2019-12-04 05:25:10
Source

zsh is vehicle pushd attribute :

setopt autopushd

and also along with that :

alias dirs='dirs -v'

So that any time, I can type dirs and also I get the background of where I have actually been :

0   /var/log
1   /tmp
2   /usr/local/bin
3   ~

and afterwards I can cd back right into as an example /usr/local/bin by keying :

cd ~2
0
2019-12-04 05:24:54
Source

My favs are listed below. I make use of a lot of them consistently

df - k (check filesystems) eliminate or eliminate - 9 (eliminate a procedure) set - o vi (set your command line to vi) topas (efficiency device) mount/unmount

oh yeah and also just how can I neglect the > (to reroute result to a documents) ls >/ tmp/tmp. txt

Many extra yet some off the top of me head.

0
2019-12-04 05:23:40
Source

Mine fave is to make use of the python command to make the short-lived http web server :

python - m SimpleHTTPServer

and also accessing documents from this equipment over the lan as :

http://192.168.1.70:8000

Another one is to download and install the tar documents in removed kind as :

wget - qO - http://192.168.1.70:8000/test.bz2 | tar xjvf -

Here the link can be any kind of over the www and also bz2 can be either gz, tgz or bz2 itself for that issue.

0
2019-12-03 05:35:40
Source

Backup your expensive dot documents automagically

Modular.bashrc - - >. bashrc.d

mkdir -p ~/.bashrc.d
cat<<'EOF' >> ~/.bashrc
echo ""
echo -n ".bashrc.d warming up: "
for script in ~/.bashrc.d/* ; do
  if [ -x "$script" ] ; then
    echo -n "${script##*/} "
    . "$script"
  fi
done
echo ""
echo ""
echo "  All systems are go."
echo ""
EOF

Safer rm, suitable with Linux and also Mac OS X

rm() {
  local src
  local final_status=0

  for src in "[email protected]"; do
    # Process only non command-line arguments.
    if [[ "$src" != -* ]]; then
      local trash="$HOME/.Trash"
      if [ ! -e "$src" ]; then
        echo "Safer rm: $src: No such file or directory."
        final_status=1
      fi
      # Create the trash directory if needed.
      if [ ! -d "$trash" ]; then
        # Assume Mac trash, but it'll work on *nix too.
        mkdir -p "$trash"
        if [ ! -d "$trash" ]; then
          echo "Safer rm: Unable to create trash directory $trash"
          echo ""
          echo "   Nothing moved or deleted.  Consider carefully:"
          echo ""
          echo "      /bin/rm -rf $src"
          return 1
        fi
      fi
      local dest="$trash/${src##*/}"

      # Find a filename combination which does not already exist.
      if [ -e "$dest" ]; then
        # Try appending ISO datetime.
        dest="$dest.$(date +%Y-%m-%dT%H-%M-%S)"
        if [ -e "$dest" ]; then
          local n=1
          # Try increasing monotony.
          while [ -e "$dest.$n" ]; do
            n = $[n + 1]
          done
          dest="$dest.$n"
        fi
      fi
      echo -n "Safer rm: Trashing $src to $dest ..."
      /bin/mv "$src" "$dest"
      echo " done."
      echo ""
      echo "  To restore:  /bin/mv     '$dest' '$src'"
      echo ""
      echo "  To purge:  /bin/rm -rf '$dest'"
      echo ""
      echo ""
    fi
  done
  return $final_status
}

Super warm 'cd' up activity

# Don't ask why I need 15 levels of cd ..

alias ..='cd ..'
alias .2='cd ../..'
alias ...='.2'
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'
alias .6='cd ../../../../../..'
alias .7='cd ../../../../../../..'
alias .8='cd ../../../../../../../..'
alias .9='cd ../../../../../../../../..'
alias .10='cd ../../../../../../../../../..'
alias .11='cd ../../../../../../../../../../..'
alias .12='cd ../../../../../../../../../../../..'
alias .13='cd ../../../../../../../../../../../../..'
alias .14='cd ../../../../../../../../../../../../../..'
alias .15='cd ../../../../../../../../../../../../../../..'

Readline is your one real god.

bind -p | egrep -v '(not|self)' # No existential jokes included.

Terminal typefaces

After considering bazillions of typefaces, I make use of 14 pt Monaco, Anti-aliased with iTerm2.

On Mac (Apps) : Try this application that offers key bindings.

KeyCue (tm) (r) (c) ($) offers context of virtually ANY running application by merely holding command.

0
2019-12-03 05:34:58
Source

get the documents name with one of the most current timestamp in the existing directory site :

latest () { ls -lrt | tail -1 | awk '{print $NF}' }

0
2019-12-03 01:53:14
Source

Not actually a one - lining yet I assume it serves. Transform several documents to uppercase, as an example file_to_upper *php *c. There are several comparable instances like transforming to lower, relabeling all documents by suffix/prefix, etc

file_to_upper ()
{
    for file in "[email protected]"
    do
        if [ ! -f "$file" ]; then
            echo "File $file does not exist";
        else
            mv -f "$file" "`echo "$file" | tr '[a-z]' '[A-Z]'`"
        fi
    done

    return 0
}
0
2019-12-02 00:17:00
Source
  • The do - absolutely nothing command : as in

    while :; do :; done
    
  • Brace development in mix with for loopholes :

    for c in {1..3}; do :; done
    
  • ! driver and also brief circuiting drivers || and also &&

    [ -d /tmp/dir ] || mkdir /tmp/dir
    
    if ! ping 34.41.34.1; then :; fi
    
  • making use of below coverings as opposed to pop/push (can be found in convenient in manuscripts)

    ~$ ( cd /tmp; echo $PWD )
    /tmp
    ~$
    
  • the kind - of what - is command type

    ~$ type type
    type is a shell builtin
    ~$ type ls
    ls is aliased to `ls --color=auto'
    ~$ f(){ :; }
    ~$ type f
    f is a function
    f () 
    { 
         :
    
    }
    
  • additionally really wonderful : below - strings

    ~$ cat <<<"here $PWD"
    here /home/yourname
    ~$
    
  • and also my favored : redirection on a checklist of commands

    { w; ps; ls /tmp; } 2>/dev/null |less
    
0
2019-12-02 00:14:18
Source

My favorite command is 'locate', I utilize it almost everywhere ... instances :

find . -name "*.log" -exec ls -l {} \; | grep "$(find . -name "*.log" -exec ls -l {} \;| nawk '{print $5}' | sort -n | tail )"

Just present heaviest documents in ls - l (lengthy) layout.

After that, if you require your code with 0640 approvals, simply search :

find . \( \( ! -perm 0640 \) -a \( -name "*.cpp" -o -name "*.h" \) \) -ls | nawk '{print $3"\t"$11}'

or change :

find . \( -name "*.cpp" -o -name "*.h" \) | xargs chmod 640

Then, do you require an icon and also do not recognize where is it??

(
  for myObj in $(find . -name "*.o"); do
    gotSym=$(dump -Xany -t $myObj | grep .MY_SYMBOL)
    if ! test "x$gotSym" = "x"
    then
      echo "OBJECT [$myObj] ========================"
      echo "$gotSym"
      echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"^
    fi
  done
)

Newer documents than XFILE??

find . -newer XFILE -type f

Yeah, "find" rulez!

0
2019-12-02 00:10:00
Source

Replace components of the previous command:

^search^replace

$ echo a b c d
a b c d
$ ^b c^X
echo a X d
a X d

Great for typos:

$ mkae
-bash: mkae: command not found
$ ^ka^ak
make
[...]
0
2019-05-30 17:13:45
Source

I located the adhering to valuable when frequently switching over in between Windows and also Unix/Linux:

alias dir="ls -l"
alias copy="cp"
alias del="rm"
0
2019-05-21 00:07:50
Source

Once so usually when you've keyed in a lengthy command and also prior to completing it you've understood it will not function today, due to the fact that you require to run another thing prior to (as an example got in git commit -m "long commit message here"), you can strike ^A^K to head to the start of the line and also eliminate it (conserving right into a barrier), next run a command to deal with points, and also ultimately ^Y to paste the eliminated command, and also proceed. Conserves a great deal of re - keying. All this, certainly is when readline remains in Emacs setting.

Afterward - saver: mkdir -p some/nested/dirs/to/be/created develops all the dirs in a course if they are missing out on.

0
2019-05-19 23:01:05
Source
# change chmod to file dowloaded --> $_

wget -c http://link/to/file -O /path/to/save/namefile && chmod 0755 $_

# extract tar.bz2 or tar.gz whit less work
# this avoids having to unpack and then move the files to another location, in this case have # already extracted in the desired location

tar jxvf file.tar.bz2 -C /pat/to/extract

# calculator with bc - in bashrc
calc(){ echo "scale=2;[email protected]" | bc;}

# set magic-space in bashrc
bind Space:magic-space                 # !pin<space>  expand last cmd pin...

# alias to open last edited file in vim
alias lvim="vim -c \"normal '0\""

# alias to show your path set
alias path='echo -e ${PATH//:/\\n}'
0
2019-05-18 08:34:08
Source
function calc() { echo $* p | dc }

dc is a RPN calculator ; this function allows me to type the expression as the command debates:

$ calc 5 3 +
8
0
2019-05-18 08:33:00
Source

There is a wonderful website for this at: http://www.commandlinefu.com/commands/browse

0
2019-05-17 19:37:38
Source

sync ;sync ;sync ;reboot

can be actually valuable occasionally. Take care!

0
2019-05-12 05:52:41
Source

I have this in my.bashrc

#shortcut for CTRL+C and CTRL+V
alias c-c='xclip -sel clip'
alias c-v='xclip -o -sel clip'

function find-all() {
    python -c "import re
import sys
for i in re.findall('$1', sys.stdin.read()):
    if type(i) == type(''):
        print i
    else:
        print i[0]"
}

And when I have html resource code in clipboard and also intend to locate all links I make use of

c-v | find-all 'href="([^"]*)"' | c-c

And I have all links in clipboard

I additionally have this function

function lsq(){
    ls -lh [email protected] | tr -s ' ' | cut -d' ' -f5,8
}

which display dimension (human legible) and also filename.

alias temp='cat /proc/acpi/thermal_zone/THRM/temperature'

this pen name is for show temerature

function separate() {
    python -c "import sys,re; print '$1'.join(re.split('\s*', sys.stdin.read().strip()))";
}

with this function I can compute item or amount of debates.

alias sum='separate + | bc'
alias product='separate * | bc'

function split-join() {
    python -c "import sys,re; print '$2'.join(re.split('$1', sys.stdin.read().strip()))";
}

This is usefull function which divided typical input divided by regex and afterwards sign up with the outcome.

function factorial() {
    seq -s* $1 | bc
}

factorial function

function wiki() { dig +short txt $1.wp.dg.cx; }

This function display wiki message over DNS

I additionally have 3 shade funcions

function blue() {
    echo -e "\x1b[34m\x1b[1m"[email protected]"\x1b[0m";
}

function green() {
    echo -e "\x1b[32m\x1b[1m"[email protected]"\x1b[0m";
}

function red() {
    echo -e "\x1b[31m\x1b[1m"[email protected]"\x1b[0m";
}
function md5check() {
    test `md5sum $2 | cut -d' ' -f1` = "$1" && green [OK] || red [FAIL]
}

This function confirm documents md5 hash.

this will certainly show mistake message for an offered code

function strerror() { python -c "import os; print os.strerror($1)"; }

You can publish all messages with

alias all-errors='for i in `seq 131`; do echo -n "$i: "; strerror $i; done'
0
2019-05-12 05:50:30
Source

See this question .

When you run ps ax | grep string:

[[email protected] ~]$ ps ax | grep 'openbox'
 3363 ?        Ss     0:00 /usr/bin/openbox
 3382 ?        Ss     0:00 /usr/bin/ssh-agent -- /usr/bin/openbox-session
 3386 ?        S      0:00 /bin/sh /usr/bin/openbox-session
 3388 ?        S      0:00 /bin/sh /usr/bin/openbox-session
 3389 ?        S      0:00 /bin/sh /usr/bin/openbox-session
 3390 ?        S      0:00 /bin/sh /usr/bin/openbox-session
 5100 pts/0    S+     0:00 grep openbox

the last line having grep is somethings a little bit anoying

You can clear on your own of this by running ps ax | grep '[s]tring':

[[email protected] ~]$ ps ax | grep '[o]penbox'
 3363 ?        Ss     0:00 /usr/bin/openbox
 3382 ?        Ss     0:00 /usr/bin/ssh-agent -- /usr/bin/openbox-session
 3386 ?        S      0:00 /bin/sh /usr/bin/openbox-session
 3388 ?        S      0:00 /bin/sh /usr/bin/openbox-session
 3389 ?        S      0:00 /bin/sh /usr/bin/openbox-session
 3390 ?        S      0:00 /bin/sh /usr/bin/openbox-session

upgrade : or simply run pgrep string

0
2019-05-12 04:41:30
Source

Brace Expansion :

Brace development is a device through which approximate strings might be created.

It permits you to change laborious lines like:

mv loong/and/complex/file/name loong/and/complex/file/name.bacukup

with a much shorter instance

mv loong/and/complex/file/name{,backup}

a few other usages

# to display the diff between /etc/rc.conf and /etc/rc.conf.pacsave
diff /etc/rc.conf{,.pacsave}

# to list files in both /usr/share and /usr/local/share
ls /usr/{,local}/share 

Arithmetic Expansion :

Arithmetic development permits the analysis of a math expression and also the replacement of the outcome. The layout for math development is:

$((expression))

The expression is dealt with as if it were within double quotes, yet a double quote inside the parentheses is not dealt with particularly. All symbols in the expression undertake parameter development, string development, command replacement, and also quote elimination. Math developments might be nested.

$ a=1
$ b=2
$ echo $(( a+(b*2) ))
5
0
2019-05-12 02:32:52
Source

Use pgrep foo as opposed to ps aux | grep foo if you intend to locate the amount of circumstances of foo are running and also their pids:

as an example as opposed to ps aux | grep firefox, usage pgrep firefox

0
2019-05-10 23:33:04
Source

See command result upgraded every n secs

watch -n 60 df -h (displays df -h every 60 seconds)

Show data concerning network tool wlan0

ip -s link ls wlan0

Show transmitting table for tool eth1

ip route ls dev eth1

Display data for all routers package takes a trip via to get to HOST

mtr --interval 5 HOSTNAME

Consult turn around DNS documents for host names on NETWORK

nmap -sL NETWORK

Benchmark an internet site

ab

Get all web links from a website

lynx -dump http://www.yahoo.com | awk '/http/{print $2}'

Show default portal

netstat -rn | awk '/UG/{print $2}'

Write typical mistake to a documents

foo 2> errors.txt

Redirect stderr to stdout

foo 2>&1

Redirect both stderr and also stdout to the very same documents.

foo > file.txt 2>&1
0
2019-05-10 18:01:30
Source

Sometimes celebration setups are such that rm is aliased to rm -i and also hence calls for verification for each and every documents being removed. When I function periodically on such an account, I make use of \rm to fetch the initial practices of rm without transforming customer arrangement.

0
2019-05-10 14:23:24
Source

Displays a wonderful ascii art of the existing proccess tree, with one of the most cpu extensive proccess higlighted.

while true; do 
  clear; 
  pstree $( ps -eo pid --sort %cpu | tail -n 1 ); 
  sleep 1;
done

Kill it with Ctrl + C

0
2019-05-10 11:29:00
Source

The ampersand . It places your command behind-the-scenes, so you can proceed keying.

$> sudo updatedb &

Working along, and also eventually you see :

[1] 17403

And your procedure is done! Great for points where you do not require to await them to end.

0
2019-05-08 19:54:18
Source

Tab conclusion . Just how negative would certainly it draw if you needed to type out all the personalities of every course?

0
2019-05-08 19:48:57
Source

I have actually folders called in my residence folder as Document, Downloads, Temp, etc with the first letter in capital. When I work with the incurable it's frustrating to change press the first key when you are cd' ing right into a directory site. Simply type in the adhering to in your incurable and also celebration would certainly vehicle - deal with the instance for you.

shopt -s nocaseglob
0
2019-05-08 19:39:24
Source

The screen command. It primarily conserves your command line session for when you return. It's type of an incurable supervisor, like a window supervisor. In this way, in a solitary incurable session, you can have numerous digital terminals taking place. It's really trendy.

If one makes use of screen, this shell function (place it right into .bashrc) is exceptionally valuable :

function scr {
    if screen -ls | grep -q Main; then
         # reattach to Main: 
         screen -xr Main
    else
         # name session "Main":
         screen -S Main
    fi
   }

upon keying scr, it will certainly examine if your major session exists and also will certainly affix to it. Or else it will certainly create it.

0
2019-05-08 18:45:25
Source

Pretty standard, yet individuals do not appear to recognize, returns you to the previous dir :

cd -
0
2019-05-08 18:41:00
Source

Umount last placed tool :

mount /media/whatever
...
u!mo

!mo increases to the last command that began with mo (at the very least in celebration). Occasionally one does mv between, so u!m will not function as usually.

0
2019-05-08 18:30:15
Source

I can not live without

set editing-mode vi
set blink-matching-paren on

in my ~/. inputrc.

Triggers them in every readline made it possible for application. Just turning on vi command line editing and enhancing in the shell functions using :

set -o vi

Thus, striking ESC or CTRL+[ obtains you the popular vi - command setting. And also you can make use of effective vi regulates almost everywhere!

0
2019-05-08 18:25:29
Source

diff the result of 2 commands without developing a short-lived documents by hand (celebration) :

diff <(ls dir1) <(ls dir2)
0
2019-05-08 14:34:53
Source

A ZSH - details attribute is suffix pen names, set by offering alias the -s flag :

alias -s ext=program
.

If an offered expansion has a suffix pen names, you can execute a documents with that said extention straight, and also ZSH will certainly release the offered program and also pass the filename as an argument. So if the above pen names holds, these lines are equal :

/path/to/foo.ext
program /path/to/foo.ext
.
0
2019-05-08 14:05:51
Source

One of my all - time favored ZSH attributes is called directory sites. You can export a variable with an offered name, with a value that indicates a particular course :

export foo=/usr/bin
.

Currently you can make use of ~foo in a command to describe /usr/bin :

cd ~foo
~foo/ls
cat ~foo/filename
.
0
2019-05-08 14:03:29
Source

If you are a rapid typist, these can be found in convenient :

alias grpe='grep --color=tty'
alias gpre='grep --color=tty'
alias rgep='grep --color=tty'
alias gerp='grep --color=tty'

This macro aids you calculate total amounts of a column of result : documents dimensions, bytes, packages, all you need to do is define the column that you intend to add :

total ()
{
        if [ x$1 = x ]; then set `echo 1`; fi
        awk "{total += \$$1} END {print total}"
}

You utilize it similar to this as an example, without debates, it includes the total amount of the first column :

du | total

If you give the argument, it will certainly sum that column, as an example, this offers you the complete variety of bytes made use of by all the C# documents in/ tmp :

ls -l /tmp/*cs | total 5

Occasionally your console obtains screwed up due to the fact that you mistakenly watched a binary documents (pet cat/ bin/ls as an example), you can recover the incurable with this shell function :

restaura ()
{
    perl -e 'print "\e)B";'
}

I like my ls to make use of personalities to identify the class of documents, as well as additionally to hide the back-up submits created by my editor (back-up documents end with the ~ personality) :

alias ls='ls -FB'
0
2019-05-08 12:26:57
Source

My individual fave is

find . -name <i>filename</i> | xargs grep -in '<i>pattern to search for</i>'

What the above command does is locate a documents of name x and afterwards searches claimed apply for whatever pattern you are seeking. Unbelievably valuable if you are seeking a certain little code in a documents that's someplace in your subdirectories.

0
2019-05-08 11:29:17
Source

If you require to modify a specifically lengthy command line in celebration

^X^E (Ctrl-X Ctrl-E) 

will certainly open it in the editor ($ EDITOR).

In zsh you can get the very same practices by including this to.zshrc :

autoload edit-command-line
zle -N edit-command-line
bindkey '^X^e' edit-command-line 
0
2019-05-08 11:09:11
Source

None of the adhering to 'methods' is practically tough or remarkable, yet they have some influence on the various other individual. If we can not utilize our work to make our lives better, after that we need to reconsider concerning some points.

I such as alias. My favored method is to modify the ~/. bash_aliases on the computer system of my gf as she is missing out on and also add a line like :

alias gfname='echo Myname is thinking of you'

or an additional enchanting quote.

An additional "method" I specifically such as is :

#!/bin/bash
xaa=123`
for ((a=1; a <= xaa; a++))
do
#sleep 1;
mail -s "Happy Birthday $a" [email protected] < mails.txt
done
exit 0`

where 123 is the of the individual to whom I would love to desire satisfied birthday celebration and also mails.txt has the message that I would love to write as the body of the email. Rest 1 ; is occasionally essential as there is a restriction on fork (). You can additionally make use of command line debates $1 and so on.

0
2019-05-08 10:44:37
Source

My favored is

man 7 ascii

Straightforward therefore really valuable.

   Oct   Dec   Hex   Char                        Oct   Dec   Hex   Char
   ────────────────────────────────────────────────────────────────────────
   000   0     00    NUL '\0' (null character)   100   64    40    @
   001   1     01    SOH (start of heading)      101   65    41    A
   002   2     02    STX (start of text)         102   66    42    B
   003   3     03    ETX (end of text)           103   67    43    C
   004   4     04    EOT (end of transmission)   104   68    44    D
   005   5     05    ENQ (enquiry)               105   69    45    E
   006   6     06    ACK (acknowledge)           106   70    46    F
   007   7     07    BEL '\a' (bell)             107   71    47    G
   010   8     08    BS  '\b' (backspace)        110   72    48    H
   011   9     09    HT  '\t' (horizontal tab)   111   73    49    I
   012   10    0A    LF  '\n' (new line)         112   74    4A    J
   013   11    0B    VT  '\v' (vertical tab)     113   75    4B    K
   014   12    0C    FF  '\f' (form feed)        114   76    4C    L
   015   13    0D    CR  '\r' (carriage ret)     115   77    4D    M
   016   14    0E    SO  (shift out)             116   78    4E    N
   017   15    0F    SI  (shift in)              117   79    4F    O
   020   16    10    DLE (data link escape)      120   80    50    P
   021   17    11    DC1 (device control 1)      121   81    51    Q
   022   18    12    DC2 (device control 2)      122   82    52    R
   023   19    13    DC3 (device control 3)      123   83    53    S
   024   20    14    DC4 (device control 4)      124   84    54    T
   025   21    15    NAK (negative ack.)         125   85    55    U
   026   22    16    SYN (synchronous idle)      126   86    56    V
   027   23    17    ETB (end of trans. blk)     127   87    57    W
   030   24    18    CAN (cancel)                130   88    58    X
   031   25    19    EM  (end of medium)         131   89    59    Y
   032   26    1A    SUB (substitute)            132   90    5A    Z
   033   27    1B    ESC (escape)                133   91    5B    [
   034   28    1C    FS  (file separator)        134   92    5C    \  '\\'
   035   29    1D    GS  (group separator)       135   93    5D    ]
   036   30    1E    RS  (record separator)      136   94    5E    ^
   037   31    1F    US  (unit separator)        137   95    5F    _
   040   32    20    SPACE                       140   96    60    `
   041   33    21    !                           141   97    61    a
   042   34    22    "                           142   98    62    b
   043   35    23    #                           143   99    63    c
   044   36    24    $                           144   100   64    d
   045   37    25    %                           145   101   65    e
   046   38    26    &                           146   102   66    f
   047   39    27    '                           147   103   67    g
   050   40    28    (                           150   104   68    h
   051   41    29    )                           151   105   69    i
   052   42    2A    *                           152   106   6A    j
   053   43    2B    +                           153   107   6B    k
   054   44    2C    ,                           154   108   6C    l
   055   45    2D    -                           155   109   6D    m

   056   46    2E    .                           156   110   6E    n
   057   47    2F    /                           157   111   6F    o
   060   48    30    0                           160   112   70    p
   061   49    31    1                           161   113   71    q
   062   50    32    2                           162   114   72    r
   063   51    33    3                           163   115   73    s
   064   52    34    4                           164   116   74    t
   065   53    35    5                           165   117   75    u
   066   54    36    6                           166   118   76    v
   067   55    37    7                           167   119   77    w
   070   56    38    8                           170   120   78    x
   071   57    39    9                           171   121   79    y
   072   58    3A    :                           172   122   7A    z
   073   59    3B    ;                           173   123   7B    {
   074   60    3C    <                           174   124   7C    |
   075   61    3D    =                           175   125   7D    }
   076   62    3E    >                           176   126   7E    ~
   077   63    3F    ?                           177   127   7F    DEL

Look at this internet site commandlinefu.com.

You can additionally look at these 4 write-ups by Peteris Krumins on his blog site

0
2019-05-08 10:19:08
Source

Two celebration features which conserve me several key strokes.

Do instantly an ls after every successfull cd :

function cd {
    builtin cd "[email protected]" && ls
}
.

Rise n degrees :

# Usage .. [n]
function .. (){
    local arg=${1:-1};
    local dir=""
    while [ $arg -gt 0 ]; do
        dir="../$dir"
        arg=$(($arg - 1));
    done
    cd $dir #>&/dev/null
}
.
0
2019-05-08 09:17:47
Source

One point that conserves me a great deal of time is the pushd/popd commands. These individuals allow you create a pile of directory sites and also lower keying a whole lot :

/foobar/ > pushd /src/whatever/foo/test
/foobar/src/whatever/foo/test > make run
/foobar/src/whatever/foo/test > popd
/foobar/ > make
0
2019-05-08 09:07:06
Source

Not certain if this counts as a "method", yet individuals appear really not aware of the typical readline hotkeys. Of certain usage in coverings :

  • Ctrl+ U - Cut the existing line
  • Ctrl+ Y - Paste a line reduced with Ctrl+ U
  • Ctrl+ L - Clear the screen and also revise the existing line
  • Ctrl+ G - Get a new line and also desert the existing one
0
2019-05-08 08:20:33
Source

Display a punctual where the hostname is vibrant . I attempted shade motivates for some time, yet the shade would certainly occasionally look negative relying on the history. Vibrant benefit me for light history, dark history, blue histories, etc

This remains in my.bashrc :

    bold=$(tput bold)
    reset=$(tput sgr0)
    export PS1="\[email protected]\[$bold\]\h\[$reset\]:\w \$ "
.
0
2019-05-08 08:18:12
Source

You can make use of CDPATH to set up the directory site matching of PATH ; if you attempt to cd foo and also there is no foo in the existing directory site, the shell will certainly examine each of the directory sites in CDPATH seeking foo in them, and also button to the first one it locates :

export CDPATH="/usr"
cd bin # switches to 'bin' if there is one in the current directory, or /usr/bin otherwise
0
2019-05-08 08:03:30
Source
vi `which scriptname`
.

For when you do not recognize where something lives, and also you uncommitted either.

0
2019-05-08 07:57:49
Source

I enjoy chucking as much things as I can right into my PS1. Some valuable points to bear in mind :

\e[s and also \e[u conserve and also unsave the arrow placement specifically. I utilize this to create an 'details - bar' on top of the screen, a number of lines long, which can fit extra things. Instance :

PS1='\[\e[s\e[7m\e[1;1H\]\w\n\t        \j / \! / \#\[\e[u\e[0m\e[33;1m\][\[email protected]\h \[\e[34m\]\W]\[\e[0m\]\$ '

Incorporate with alias clear='echo -e "\e[2J\n"'. Attempt it out!

Additionally, the PROMPT_COMMAND variable specifies a command to execute prior to the PS1 every single time.

An additional one is the bg command. If you neglect to place & at the end of a command, simply press ^Z and also type bg, and also it runs in the history.

0
2019-05-08 07:54:53
Source

Display Git branch and also standing in the punctual

export GIT_PS1_SHOWDIRTYSTATE=true

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\[email protected]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 "#%s")\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\[email protected]\h:\w$(__git_ps1 "#%s")\$ '
fi
0
2019-05-08 07:50:38
Source

CTRL+ R in BASH for searching/activating formerly implemented commands (the materials of ~/. bash_history).

This is usually exceptionally handy. Running this pen names will certainly offer the PWD up over HTTP (indexed) on port 8000 :

alias webserver="python -m SimpleHTTPServer"

And also due to the fact that I run make regularly, and also spaz out and also type also promptly, these pen names are possibly my most made use of (seriously) :

alias maek=make
alias mkae=make
alias meak=make
alias amka=make
alias akme=make

And also possibly my most regularly made use of item of BASH is a straightforward manuscript I call upload. I utilize it to blit any kind of sort of web content to my Linode, and also it duplicates the resulting HTTP URL to my clipboard (center click). Really valuable for pasting things to individuals in IRC :

scp -r $* [email protected]$host:public_html && {
    URL="http://$host/~$user/$(basename $1)"
    echo "$URL"
    xselection -replace PRIMARY "$URL"
}

Simply a pair. I can upload far more later on, have to get back to function!

0
2019-05-08 07:34:22
Source

my favored attribute is NO COLORS! =)

TERM = xterm - mono or TERM = linux - m relies on OS ...

I actually like black and also white IRSSI, mc and also any kind of various other "Text interface" device

0
2019-05-08 07:28:43
Source

This is for zsh, not slam, fyi (if you have not utilized it, you will not be sorry for attempting it out). This is actually valuable for promptly keying out long courses for scp transfers. It functions similar to making use of to finish or detail readily available filenames/directories.

Instance

scp [email protected]:/home/webdev/domains/example.com/http.public/long<tab>

will certainly finish the course to /home/webdev/domains/example.com/http.public/longdirname.

I'm negative at instances, yet that need to offer you the suggestion. Attempt it out, it can actually conserve you fingers from keying.

# SSH Completion
zstyle ':completion:*:scp:*' tag-order \
   files users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *'
zstyle ':completion:*:scp:*' group-order \
   files all-files users hosts-domain hosts-host hosts-ipaddr
zstyle ':completion:*:ssh:*' tag-order \
   users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *'
zstyle ':completion:*:ssh:*' group-order \
   hosts-domain hosts-host users hosts-ipaddr
zstyle '*' single-ignored show
0
2019-05-08 07:12:44
Source

Execute last command as origin :

sudo !!
0
2019-05-08 07:11:34
Source

Another valuable ZSH method :

Treat the result of a command as a documents :

emacs =(hg cat -r 100 somefile)

This opens up an old variation of a Mercurial - tracked documents in emacs for syntax - highlighted watching. Without that, I would certainly need to mess around with hg revert, hg archive, or clearly send hg cat result to a short-lived documents.

Certainly, this collaborates with any kind of program that opens up documents, and also any kind of program that publishes to typical result.

0
2019-05-08 06:56:16
Source

ZSH has international pen names. It increases the pen names throughout the command line. I've located this valuable for hostnames :

E.g. :

alias -g sub='sub.domain.tld'
.

After that, I can do as an example :

sftp sub
ssh sub
.

etc

0
2019-05-08 06:52:45
Source

Since I'm generally midway right into a command line prior to intending to look (CTRL - R in celebration) I have the adhering to in my.bashrc

bind '"\e[A"':history-search-backward
bind '"\e[B"':history-search-forward
.

This suggests that if I type cd after that press up/down I can see all the alternatives that I have actually cd would certainly to. Primarily I utilize this for usually made use of dirs. Like "cd w" and also I'm winding up experiencing all the work spaces I make use of whole lots.

0
2019-05-08 06:35:16
Source

If a command takes stdin input, you can read the input from a documents with <filename. This can show up throughout the command, so these lines are equal :

cat filename
cat <filename
<filename cat
.

This is specifically valuable for grep, as it permits you to position the expression at the end of the line, so you can promptly change a grep command it by striking Up, without requiring to scroll entrusted to surpass the filename :

<filename grep 'expression'
.
0
2019-05-08 06:23:40
Source

This is generally in my start-up manuscript (. bashrc,. account, whatever)

shopt benefits, examine the remarks :

shopt -s cdspell        # try to correct typos in path
shopt -s dotglob        # include dotfiles in path expansion
shopt -s hostcomplete   # try to autocomplete hostnames
.

A pen names that conserve keystrokes : mkdir and also cd right into it :

mkcd () { mkdir -p "[email protected]" && cd "[email protected]"; }
.

And also finally, I've surrendered on remembering tar syntax, so :

extract () {
    if [ -f $1 ] ; then
        case $1 in
            *.tar.bz2)  tar xjf $1      ;;
            *.tar.gz)   tar xzf $1      ;;
            *.bz2)      bunzip2 $1      ;;
            *.rar)      rar x $1        ;;
            *.gz)       gunzip $1       ;;
            *.tar)      tar xf $1       ;;
            *.tbz2)     tar xjf $1      ;;
            *.tgz)      tar xzf $1      ;;
            *.zip)      unzip $1        ;;
            *.Z)        uncompress $1   ;;
            *)          echo "'$1' cannot be extracted via extract()" ;;
        esac
    else
        echo "'$1' is not a valid file"
    fi
}
.
0
2019-05-08 06:21:25
Source

celebration - - insert coming before line's last parameter

alt - . one of the most valuable key mix ever before, attempt it and also see, for one reason or another no person finds out about this set.

press it time and again to select older last parameters.

wonderful when you intend to do something even more to the argument/file you made use of simply a minute earlier.

0
2019-05-08 06:16:07
Source
alias s='sudo'
alias r='rake' # i'm a ruby developer
alias ..='cd ..' # although with autocd feature for zsh this comes packed.
.

Among my faves when I neglect s :

$ s !! # last command with super user priviledges
.
0
2019-05-08 05:51:17
Source

This increases rather on the !! method stated in this answer. There are in fact a number of background - relevant commands that often tend to get forgotten (individuals often tend to stab Up 100 times rather seeking a command they recognize they keyed in).

  • The history command will certainly show a list of lately run commands with an occasion designator to the left
  • !N will certainly replace the command related to occasion designator N
  • !-N will certainly replace the N th latest command ; as an example !-1 will certainly replace one of the most current command, !-2 the 2nd latest, etc
  • As stated in the various other solution, !! is shorthand for !-1, to promptly replace the last command
  • !string will certainly replace one of the most current command that starts with string
  • !?string? will certainly replace one of the most current command which contains string

Word designators can be added to a ! background command to change the outcomes. A colon divides the occasion and also word designators, as an example !!:0. The occasion designator !! can be abbreviated to simply ! when making use of a word designator, so !!:0 amounts !:0.

  • !:0 will certainly get the command that was implemented
  • !:1 will certainly get the first argument (and also !:2 the 2nd, etc)
  • !:2-3 will certainly get the 2nd and also 3rd debates
  • !:^ is an additional means to get the first argument. !:$ will certainly get the last
  • !:* will certainly get all debates (yet not the command)

Modifiers can additionally be added to a ! background command, each prefixed by a colon. Any kind of number can be piled on (as an example !:t:r:p).

  • h - - Line up to the base filename
  • t - - Only the base filename
  • r - - Line up to the filename expansion
  • e - - Only the filename expansion
  • s/search/replacement - - Replace the first event of search with replacement
  • gs/search/replacement - - Replace all events of search with replacement
0
2019-05-08 05:29:43
Source