Simple Tips: Working With The Shell

Working with Shell is fun! But what is Shell? Before the introduction of the graphical user interface (GUI), Linux provided only textual interface (command line interface ( CLI )). Today, a Textual interface is available when logging in from a terminal emulator.

Logging in from terminal

Today, most Linux distribution (e.g. Ubuntu) comes with “login manager” (e.g. GDM, KDM, XDM). But when you are using a distro that doesn’t come with GUI, you probably don’t have these login managers so you have to login from terminal.  You should see this

Archlinux 3.0 -ARCH (nmepntgrm) (tty1)
nmepntgrm login:  myusername
Last Login: Wed Mar 10 19:09:59 on tty1

Security Tip: See the “Last Login:” line? That’s the date , time and place you last login. If the date and time is somewhat strange, you must change your password. The place here is tty1- if you don’t know what tty1 means, that is the virtual terminal number, you can work up with many terminals, switching tty will be Ctrl + Alt + (Function number) e.g

Ctrl + Alt + f2

Will lead you to tty2. So it means many workspace in shell! How nice is that? tty1 editing using emacs , tty2 typing in commands, tty3 listening to music etc.. But when the place is not tty, it is the computer name (e.g nmepntgrm, mycomp), it means you last login from different computer.
Logging in from the network is the just same, you can use either telnet or ssh.
Note: Telnet is not secure! One reason telnet is not secure is that it send your username and password over the network in cleartext when you log in. SSH encrypts all information it send over the network so better to use ssh over telnet if possible. Example of ssh log in:

$ ssh myusername2@nmepntgrm
Last login: Wed Mar 11 20:02:06  on nmepntgrm
[myusername@nmepntgrm myusername2]$

Erasing A Character:
Erasing a character sometimes bit annoying, but with this shorcuts you will love to erase :p.
BACKSPACE  – deletes one character thesame as DEL
Ctrl+h              – deletes one character, more easy to delete than backspace
Ctrl+w             – deletes a word (characters until the last space or tab)
Closing, Suspending A Running Program:
Ctrl + z  – suspends the running program

$ emacs -nw
[1]+  Stopped                 emacs -nw
$ jobs
[1]+  Stopped                 emacs -nw
$ fg
emacs -nw
$ kill -TERM %1
[1]+  Terminated              emacs -nw

jobs will list the running jobs, fg will continue the stopped job, kill -TERM %1  will kill (oh brutal) a job.
Ctrl + c will close a program, but you cannot close some app with this (e.g emacs)
That’s All for now, I will discuss the power of su/sudo on my next post 🙂
Happy Hacking!

Post Comment