Below are some useful Unix commands
Insert Text
Move Cursor
Command
|
Description |
k | Move cursor up one line |
j | Move cursor down one line |
h | Move cursor to the left one character position |
l | Move cursor to right one character position |
0 or | | Put cursor at beginning of line |
$ | Put cursor at end of line |
w | Move cursor to next word |
b | Move cursor to previous word |
( | Move cursor to beginning of current sentence. |
) | Move cursor to beginning of next sentence |
G | Move cursor at the last line of the file |
H | Move cursor to top of screen |
Insert Text
Command | Description |
i | insert text before current cursor location |
a | insert text after current cursor location |
o | Creates a new line for text entry below cursor location |
Delete Line
Command | Description |
x | Deletes character under cursor position |
X | Delete character before cursor position |
dw | Deletes the current word |
d$ | delete all content to the right of the cursor |
dd | Deletes the current line |
Copy and Paste
Some other useful commands
Command | Description |
yy | Copy current line |
yw | Copy word |
p | paste last copied/cut/deleted text after current cursor position |
Some other useful commands
Command | Description | Example |
cat | display file contents
or Copy one or more file content to another file |
Cat
Cat fiel1 file2 > fileNew |
chgrp | change file group | |
chmod | Changes the read, write and execute permissions for the file | chmod [mode] fileName |
cp | copy source file into destination | cp [file1] [directory]/[file2] |
grep | Search content in file | grep ^H fileName : It list all words start with H |
head | display first 10 lines of a file | head fileName |
tail | display last 10 lines of file | tail fileName |
ls | display content of directory | ls |
mkdir | make directory | mkdir dirName |
cd | change directory | cd dirName |
more | display data in paginated form | |
mv | move or rename file form old to new | mv file1 file2 |
rm | remove/delete file | rm fileName |
rmdir | Removes
or erases empty directory. You must first use `rm *' to empty the file |
rmdir dirName |
pwd | print current working directory | pwd |
wc | count words. Lines and characters | |
who | Displays currently logged in users. | who |
who am i | Displays current user id and access. | who am i |
No comments:
Post a Comment