- Everything in Linux is a file including the hardware and even the directories.
- # : Denotes the super(root) user
- $ : Denotes the normal user
- /root: Denotes the super user’s directory
/home: Denotes the normal user’s directory.- Switching between Terminals
Ctrl + Alt + F1-F6: Console login
Ctrl + Alt + F7: GUI login- The Magic Tab: Instead of typing the whole filename if the unique pattern for a particular file is given then the remaining characters need not be typed and can be obtained automatically using the Tab button.
- ~(Tilde): Denotes the current user’s home directory
- Ctrl + Z: To stop a command that is working interactively without terminating it.
- Ctrl + C: To stop a command that is not responding. (Cancellation).
- Ctrl + D: To send the EOF( End of File) signal to a command normally when you see ‘>’
- Ctrl + W: To erase the text you have entered a word at a time.
- Up arrow key: To redisplay the last executed command. The Down arrow key can be used to print the next command used after using the Up arrow key previously.
- The history command can be cleared using a simple option –c (clear).
- cd : The cd command can be used trickily in the following ways:
cd : To switch to the home user
cd * : To change directory to the first file in the directory (only if the first file is a directory)
cd .. : To move back a folder
cd - : To return to the last directory you were in- Files starting with a dot (.) are a hidden file.
- To view hidden files: ls -a
- ls: The ls command can be use trickily in the following ways:
ls -lR : To view a long list of all the files (which includes directories) and their subdirectories recursively .
ls *.* : To view a list of all the files with extensions only.- ls -ll: Gives a long list in the following format
drwxr-xr-x 2 root root 4096 2010-04-29 05:17 bin where
drwxr-xr-x : permission where d stands for directory, rwx stands for owner privilege, r-x stands for the group privilege and r-x stands for others permission respectively.
Here r stands for read, w for write and x for executable.
2=> link count
root=> owner
root=> group
4096=> directory size
2010-04-29=> date of creation
05:17=> time of creation
bin=> directory file(in blue)
The color code of the files is as follows:
Blue: Directory file
White: Normal file
Green: Executable file
Yellow: Device file
Magenta: Picture file
Cyan: link file
Red: Compressed file
File Symbol
-(Hyphen) : Normal file
d=directory
l=link file
b=Block device file
c=character device file
- Using the rm command: When used without any option the rm command deletes the file or directory ( option -rf) without any warning. A simple mistake like rm / somedir instead of rm /somedir can cause major chaos and delete the entire content of the /(root) directory. Hence it is always advisable to use rm command with the -i(which prompts before removal) option. Also there is no undelete option in Linux.
- Copying hidden files: cp .* (copies hidden files only to a new destination)
Mike Qaissaunee, a Professor of Engineering and Technology at Brookdale Community College in Lincroft, New Jersey, shares his experiences and perspectives on integrating new technologies in and approaches to teaching and learning. ~ Subscribe to this Blog
Wednesday, December 15, 2010
Basic Linux Command-line Tips and Tricks - Part 1
40 Basic Linux Command-line Tips and Tricks:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment