Basic Linux Commands : without which you can't survive in technical world!!!
1) ls -- to list files and directories
Examples: ls Mail, ls -a
ls -l /usr/bin
Options: -l, -a
2) cd -- Type cd followed by the name of a directory to access that directory.
Examples: cd games, cd ..
Imp: "cd -" will get you in the last working directory
3) pico -- To create or edit a file
Examples: pico myfile.txt, pico
4) vim -- Advance text editor
Example: vim myfile.txt
To learn basic vim, visit: https://www.dynamic-apps.com/linux_vim.jsp
5) chmod -- change file access permissions
Example: chmod -R 753 games
Permissions
|
alias
|
weightage
|
read
|
r
|
4
|
write
|
w
|
2
|
execute
|
x
|
1
|
In 753, the first 7 (1st letter) represents the permissions to himself, 5 (2nd letter) represents the permissions to group.
3 (3rd letter) represents the permissions to others.
Options: -R for whole directory
7=4+2+1 ; 5=4+1; 3=2+1
6) pwd -- shows the "present working directory"
7) cp -- copy the files/diectories
Examples: cp oldfile.txt newfile.txt
cp -R olddir newdir
Options: -R for copying complete directory
8) mv -- move or rename the file/directory
Examples: mv oldfile.txt newfile.txt
mv olddir newdir
9) rm -- remove files/directory
Examples: rm file1.txt
Options: -r deletes whole directory
-f deletes without asking confirmation
10) mkdir -- make a new directory
Examples: mkdir games
11) rmdir -- deletes a (empty) directory
Examples: rmdir games
12) man -- show the manual pages
Examples: man mkdir
man man
13) date -- show date and time
14) cal -- show calendar
15) du -- show file space usage
Examples: du -hs games; du ; du movie.dat
Options: -h print sizes in human readable format(e.g., 1K 234M 2G)
-s display only a total for each argument
16) passwd -- to change passwd
17) pine -- to check mails
18) logout -- make you exit
More Basic Commands -- without which you can't survive in IITB!!!
1) tin -- to check newsgroups
2) telnet -- to login into other computer/server
Example: telnet 10.107.1.2
Imp: Try command 'rlogin'
3) ssh -- secure login into other computer/server
Example: ssh agoyal@10.105.1.11
4) finger -- look for information about users logged on server
Example: finger; finger agoyal
5) talk -- talk to other user
Example: talk agoyal
6) w -- Show who is logged on and what they are doing
7) write -- write to other users
Example: write agoyal
8) ftp -- to transfer files from one computer to another
Example: ftp 10.105.1.11
Use 'gftp' for graphical interface
9) cat -- print the file(s) on standard output
Example: cat myfile.txt
Imp: Try commands 'head', 'tail', 'less', 'more'
10) alias -- alias a command
Example: alias rm='ls'
Advance Commands -- without knowing which you can't be called "STUD"
1) df -- show harddisk partitions
Example: df -h
2) locate -- locate a file containing some expression
Example: locate games
3) grep -- print lines matching a pattern
Example: locate games|grep nfs
4) find -- search for files in a directory hierarchy
Example: find . -name filename -print
5) ps -- report process status
Examples: ps; ps -aux
6) top -- display Linux tasks
7) kill, killall -- kills a process
Examples: kill -9 1290; killall -9 mplayer
Here -9 is an option to kill a process completely. 1290 is a process ID (PID).
8) tar -- compress/uncompress files/directories
Examples: tar -xvf file.tar -- uncompress a file 'file.tar'
tar -xzvf file.tar.gz -- uncompress a file 'file.tar.gz'
tar -xjvf file.tar.bz2 -- uncompress a file 'ffile.tar.bz2'
tar -cvf file.tar file -- compress the file 'file' to 'file.tar'
tar -czvf file.tar.gz file -- compress the fille 'file' to file.tar.gz
tar -cjvf file.tar.bz2 file -- compress the fiile 'file' to file.tar.bz2
9) file -- determine file type
Some More fundaes: for cool dudes
1) How to open graphical applications from other computer?
Suppose you are sitting on comp 'A' with ip 10.8.1.82. You want to open an graphical application on comp 'B' with ip 10.8.1.22. Do the following:
a) type "xhost +" on comp 'A'
b) login to comp 'B' via 'ssh' or 'telnet'
c) type "export DISPLAY=10.8.1.82:0.0" on command prompt of comp 'B'
d) open the application. e.g. 'gftp'
2) Use
for the command completion
3) Don’t waste time and energy retyping commands at the prompt. Instead, use the ! option. To automatically re-display the last command
you typed at the prompt, type: !! and press enter. Press again to invoke the command. You can also automatically re-display a command you
typed earlier by using the ! and the first few letters of the command.
Ex: At the Linux prompt you had typed the command clear, followed by the command pico, followed by the command ftp. In order to re-display the
clear command you type: !cl and press enter. In order to re-display the last command you typed, simply type: !! . Try it out. You’ll find this a time
saver when dealing with long commands. Especially commands like tar!
4) You can also use reverse search for retyping commands. e.g. type "Ctrl+r", and then type few letters of command. It will display the command.
Common Softwares in Linux
Some common softwares you will need:
1) gaim -- Instant Messenger like yahoo and msn messenger.
2) mplayer -- Movie Player like Windows Media Player in Windows.
3) xmms -- Play Songs like winamp in Windows.
4) openoffice -- Run Office Application like officexp, office2k3 in Windows.
5) mozilla -- To browse internet like Internet Explorer in Windows.
6) gftp -- for transfering files.
7) gimp -- for creating/editing pictures.
See the complete Linux Windows Equivalence Table in the last section