Friday, September 11, 2009

POWER OF TERMINAL COMMANDS

Hi guys,
I am back with a few tips in terminal.If you are left with a computer running ubuntu(any linux) -but without mouse to control..That is only you have is a keyboard to give input.What will u do?
if it is in software lab,you will move to a nearby computer .You dont have to do this if you know how to use a terminal.What ever you can do in GUI(Graphical user interface) , you can do the same using a terminal.


Opening a terminal:

* You can open a terminal window from Application ->accessories->terminal
OR
* Press ALT+F2 to open run a command window. Type " gnome-terminal" and press enter..done

* Since i am using terminal often it is difficult to go through the above steps always ..So i assigned a shortcut (some shortcuts you like , i use CTRL+A) from system->preference->keyboard shortcuts.

Its done now so that you can start typing commands.
A few useful commands:

terminal management
clear - clear the terminal window
exit - to exit
press CTRL+SHIFT+N - to get a new terminal window
sudo -s - get root power
man command - To see the manual pages associated with a command

FIle commands
ls -directory listing
ls -al -formatted listing with hidden files
cd dirname -change to specified dir
pwd -current working directory
mkdir dirname -make a new directory
rm filename -delete a file
rm -r dirname -delete a directory
cp file1 file2 -copy file1 to file2
mv file1 file2 -rename file1 as file2

Process Management

ps - displays the current running process with thier PID(process ID)
ps -ef dsplays process from all users
kill pid - kill the process with ID as pid
killall proname - kill all the process named proname
ps -ef | grep processname - Gives back the PID of the process.Now you can kill that process using kill pid


Other

Compiling a C program:
gcc filename.c
./a.out
Compiling a C++ program:
g++ filename.cpp
./a.out

Open Applications using terminal:
gedit filename.c - Opens a new file named filename.c in text editor
firefox - run firefox web browser
almost all applications will have a terminal command associated with that.Iam not mentioning them here.
########################################################

Related post : Use aliases for longer commands

*********************************************************
Ubuntu offer you a world without windows or gates..a world of freedom

No comments:

Post a Comment