Advanced

5 Tips to Make Working with the Shell Easier

Posted by Chris7mas on · Post a comment
Echoes; By Craciun Dan
Mail this story
Print this story

The article contains 5 frequent tips to make working with the shell easier.

1. Use Emacs-like shortcuts ^N calls next command, ^P calls previous command ^U deletes all the text entered to the left (use it when you wrote a wrong command and want to delete it fast instead of using Backspace or ^H) ^K deletes all the text entered to the right (from where the cursor is all to the end of line) ^F moves cursor forward one character, ^B moves it backwards ^A jumps to the beginning of the line ^D logs you out (closing the terminal application too if no other session was started inside it - the same with exit) There are plenty more, here is a list.

Note: ^ is the Ctrl character, hence ^U means press Ctrl+U at the same time.

2. Copy/paste text using middle mouse button or SHIFT+INSERT To paste some text in the terminal just use the middle mouse button (press the scroll wheel). If you don't have such a button, press left and right buttons at the same time. SHIFT+INSERT does exactly the same thing, just be careful what you copy/paste.

3. Easily count lines, words and characters in a text file with wc wc -l file.txt will count lines wc -w file.txt will count words wc -c file.txt will count characters You can also feed its input, which comes in handy when you have an essay for example and you want to know how many words it has in it. Type

wc -c

Then paste your text and press ^D when you're finished (End of File).

4. Make aliases to only type brief commands Aliases make your job easier by creating a custom, short command which will do the work of several commands. Example:

alias dup='sudo apt-get update && sudo apt-get upgrade'

A full tutorial on how to create aliases is here.

5. Create scripts and put them in a directory in your $PATH You can create handy scripts for whatever tasks you need (for example I use those for audio encoding/decoding, mass-renaming of files and several more). Just make sure to make your script executable and put it in a directory in your $PATH. On Debian for example, directory ~/bin/ is detected and added automatically to the $PATH. Otherwise, you can add it by editing ~/.bash_profile and adding:

PATH=~/bin/:$PATH

Full Story

  Nav
» Read more about: Story Type: Tutorial; Groups: Linux

» Get new stories by e-mail: nightly or as they are published

« Return to the newswire homepage

  Related stories
» More like this

Comments

No comments yet. Be the first.

Post a comment

A free account is needed to post. Write your comment here first: your text is kept in this browser while you sign up or log in, and is waiting for you when you come back.

Your message:
|||||
10
Markdown: **bold**, *italic*, [text](https://link), - lists, > quotes, $x^2$ for math. Formatting help

Sign up and post (it is free)  or  Log in and post