Sie sind auf Seite 1von 2

Linux Shell Commands mkdir <dirname rmdir <dirname> cd <dirname> cd ..

cd ~ pwd mv <srcfile> <destfile> cp <srcfile> <destfile> cp <srcfile(s)> <destDir> rm -i <file(s)> ls -l gcc <file.c> gcc -o <objfile> <file.c> ./<objfile> Make a directory <dirname> Remove the directory <dirname>(the directory must be empty to remove it) Change the current working directory to <dirname> Change the current working directory to the parent directory Change the current working directory to the your home directory show your current working directory rename the <srcfile> as <destfile> copy the <srcfile> to <destfile> copy the <srcfiles> files to <destDir> directory Delete file(s) List files in the current directory to compile the c file by default creates executable file "a.out" to compile the c file and the object code is placed in "objfile". Run the program that was compiled by gcc (here "objfile" is name of file in which obj code is placed) (ex: ./a.out if you compile your program with "gcc <file.c>") ex: gcc -g -o pro prog.c -- compile the c program in file prog.c and creates executable file pro that can be used for debugging with gdb . To come out account log in (or to terminate the treminal) To clear the screen

gcc -g -o <objfile> <file.c> exit clear

Debugger To debug prog (executable file) ,start the gdb debugger in the shell window using : gdb prog (ex: list break <n> run continue next step <ENTER> print x set x=10 quit gdb <objfilename>) List 10 lines of the c source file Set the break point program execution stops when it reaches line <n> (ex: break 15) Start program execution Continue execution from break point Execute the next line in the program and then break. Does not break in functions. Execute the next line in the program ,stepping into functions and then break Pressing the <ENTER> key repeats the previous command Display the value of variable x Set the variable x to 10 Quit the debugger

gdb commands can be abbreviated ,ex: l for list,b for break ,n for next, p for print etc.

TO CONNECT TO DCF LAB ACCOUNT : ssh -X <username>@<ipaddress> password:<type password> >>from your account only msampath@ubuntu>> scp guest@10.6.9.254:MOOL_copy.tar.bz2 ~ password:<type password> to copy mool file ----to login to dcf account

TO SEARCH FOR ANY STRING PRESENT IN DIFFRENTS FILES IN A FOLDER grep -r <string> <address of folder> ex: grep -r set_sched_policy /home/sampath/sample/MOOL_copy to search multi word string give \ before each space ex: to search sampath kumar grep -r sampath\ kumar <address>

sudo -i /su passwd root passwd

---enter as root ---to change new password if we forget old password --to change password

TO CONNECT TO COLLEGE PROXY FOR TERMINAL >>cd /etc/apt/ apt>>gedit apt.conf -change proxy and port ,user name and password

Acquire::http::proxy "http://cs10m056:<password>@hproxy.iitm.ac.in:3128/"; Acquire::ftp::proxy "ftp://cs10m056:<password>@hproxy.iitm.ac.in:3128/"; Acquire::https::proxy "https://cs10m056:<password>@hproxy.iitm.ac.in:3128/";