<<

- Basic on '' -

If you have no idea what 'bash' is, Bash is the , or language interpreter, for the gnu . Descended from the , Bash is a GNU product, the "Bourne Again SHell." It's the standard command line interface on Linux machines. It excels interactivity, supporting command line editing, completion, and recall. It also supports configurable prompts - most people realize this, but don't know how much can be done.

Also try reading CMI-Wiki http://www.cmi.ac.in/mediawiki1.9/index.php/ Using_computers

(Read about bash at following links) http://en.wikipedia.org/wiki/Bash http://www.gnu.org/software/bash/manual/bashref.html This document is concerned about introducing 'extremely basic' commands to the uninitiated. For advanced reference go to ~hrishikeshrt/Shared/Linux/

------Introduction ------

This lists and explains commands that you can run in one of the XShells Few most used XShells are "gnome-terminal", "konsole","xterm"

To run a terminal, Press Alt-F2 on your keyboard. "Run application" window will appear. in "gnome-terminal" there. Press 'Enter'

A new window will open. Most probably it will have something like following. hrishikeshrt@sl14:~ $ _ where in place of 'hrishikeshrt' you will have your username, in place of 'sl14' you will have name of machine you are logged in on, in place of '~' you will have your . gnome-terminal (or any equivalent) will invoke a "bash" shell

So now having been acquainted with procedure of opening a terminal, we will see the commands that we type in the terminal to perform various actions.

------Symbols ------

Following symbols denote certain directories

/ root directory

~ Your home folder ~ = $HOME = /home/students/ . The Directory you are currently in

.. The parent directoy of your current directory

------Important Files ------

~/.bash_profile ~/.bashrc ~/.bash_aliases (Most of you probably won't have this file) ~/.ssh/id_rsa ( ssh private-key)

* About alias alias is just way of setting names to certain commands.

alias SOMETHING='SOME OTHER THING' If you type this, then whatever used to happen by typing 'SOME OTHER THING' will now also happen when you type 'SOMETHING' eg. alias e='emacs'

In general you can add aliases to bashrc, but it is cleaner to put them in separate file.

Few useful aliases.

alias ='reset' alias :r='. ~/.bashrc' alias adobe='pdfopen --file' alias la=' -Al' alias ll='ls -l' alias ls='ls --color=auto' alias duf=' --exclude=mounts -ks * .[^.]* | -n; "";du -- exclude=mounts -sh' alias ='mkdir -m 700' alias mplayer='mplayer -stop-xscreensaver -subfont-autoscale 1' alias mutt='mutt -z'

You can put them in your ~/.bash_aliases

------Reference ------Two useful commands - man & If you know certain command and want to know what it does, type

$ man COMMAND where COMMAND is name of the command This will show a manual page about the usage of the command.

On the other hand if you want to search commands related to particular task, type

$ apropos KEYWORD

(Though soon most of you will realize that getting the right keyword might prove to be tedious and hence apropos is not much of use after all)

More resources are available at ~hrishikeshrt/Shared/Linux/

------Basic Commands ------

mkdir NAME a folder(directory) of name NAME

Change directory to DIR

ls [DIR] List the files in the directory

SOURCE DESTINATION Copying files Copies from SOURCE to DESTINATION

FROM TO files from FROM to TO

FILE Display contents of a text file

echo TEXT Prints on screen the TEXT given as input.

OPTIONS FILE To change permissions of the FILE according to options. For Private files use chmod 700 FILE For Others chmod 755 FILE (To learn more about permissions and octal code, do man chmod)

Displays your username.

du FILE shows size of file (man du for more)

(OR logout) Exit the shell

------Not so Basic ------

1) ssh-keygen -t rsa = create ssh rsa key. (create that in $HOME/.ssh)

2) Pipe | c1 | c2 = inputs output of c1 to c2

3) fusermount -u dir = to unmount the dir 4) sshfs dir = mounts path on dir

5) input = gives all lines in input containing the expression

6) cat cat f1 = Returns f1 (Displays on screen) cat f1 f2 = concates f1 and f2 to standard output

7) > Redirects the output WITH overwrite (nothing on rhs => standard output)

>> Redirects the output WITHOUT overwrite e.g. cat f1 f2 > f3

8) du (-sh) (of file/dir) = disk space used (total) (of file/dir)

9) mkdir -m *** dir = create dir with given permissions ***

10) rar -v[k|b|f] Desiredname FilePath Create volumes with size=*1000 [*1024, *1]. e.g. rar a -v980k Tractor Tractor.mpg

------

Hrishikesh Terdalkar [email protected] Chennai Mathematical Institute