Linux CMD Tastatur Befehle


Linux CMD Tastatur Befehle

  1. Ins vorherige Verzeichnis Wechseln: cd -

  2. Insert the last argument from the previous command [ESC]+.That’s hold down escape and press . This is a great one if you’re processing a file in multiple steps. The result file is often the last argument of a command then is will be an argument of the next command.

  3. Hier ist ein Beispielspromt PS1="\[\e[30;1m\]\[email protected]\h:\[\e[34;1m\]\w\n\`if [ \$? = 0 ]; then echo \[\e[30m\]! \!\[\e[30m\]\$; else echo \[\e[31m\]! \!\[\e[30\;0m\]\$; fi\` \[\e[0m\\]"It looks like this: [email protected]:****/current/working/directory ! 506$

    If the command you run returns an exit status that’s not 0, i.e. it fails, then it looks like this [email protected]:****/current/working/directory ! 506$

CMD Shortcuts

Here’s the top shortcuts I use on the command line. These should speed up your productivity quite nicely. If you’re using the Gnome Terminal on Ubuntu (possibly other distro’s too) you might need to enable ALT+f and ALT+b in the preferences.

  • ESC + .Escape key and the period/full stop at the same time will insert the last argument from the previous command. For example if your previous command is: echo Hello World Then this shortcut will insert ‘World’ and the current point. However, if your previous command was echo "Hello World" Then it will insert ‘“Hello World”’. Note also that it is relative to your position in the history. So if you have run 10 commands and you go up through your history to the fifth one and use this, it will give you the last argument from the fourth command not the tenth.
  • STRG+[PFEIL RECHTS] oder ALT+f ALT and f together will move the cursor forward by one argument.
  • STRG+[PFEIL LINKS] oder ALT+b ALT and b is the shortcut for moving the cursor back one argument.
  • ALT+d ALT und d will delete one argument forwards.

For example using it at this point: echo Hello World Would delete the word ‘World’. The removed text will go into the kill ring. Note it will not remove quotes with it. If above Hello World was quoted. It would leave “Hello”.

  • STRG+w oder ALT+BACKSPACE This deletes one argument backwards. So using the same example as above: echo Hello World This would remove ‘Hello’. Note that STRG+w does remove quotes (ALT+BACKSPACE doesn’t), so if it were: echo "Hello World" You’d be left with echo World" with one quote.
  • STRG+ALT+- This is basically undo. So if you accidentally deleted a work or line hit this to get it back.
  • STRG+k This removes from the cursor to the end of the line, and out it into the kill ring. The kill ring is basically the clipboard on the command line.
  • STRG+y This ‘yanks’ whatever is in the kill ring (clipboard) into the current position.
  • STRG+a Jump to the start of the line.
  • STRG+e Jump to the end of the line.