Pages

Sunday, 11 September 2016

Basic UNIX Commands

As we know Hadoop  works on UNIX OS before proceeding to learn Hadoop we have to know basic commands of UNIX. PSB...

Command
Example
Description
1.     ls
ls
ls -alF
Lists files in current directory
List in long format
2.     cd
cd tempdir
cd ..
cd ~dhyatt/web-docs
Change directory to tempdir
Move back one directory
Move into dhyatt's web-docs directory
3.     mkdir
mkdir graphics
Make a directory called graphics
4.     rmdir
rmdir emptydir
Remove directory (must be empty)
5.     cp
cp file1 web-docs
cp file1 file1.bak
Copy file into directory
Make backup of file1
6.     rm
rm file1.bak
rm *.tmp
Remove or delete file
Remove all file
7.     mv
mv old.html new.html
Move or rename files
8.     more
more index.html
Look at file, one page at a time
9.     touch
Touch filename
touch command is used to make files
10.   man
man ls
Online manual (help) about command
11. cat
Cat filename
Sends file contents to standard output





































Basic VI editor Commands  

Letter
Action
i
Starts inserting in front of the current cursor position
<Esc>
Gets out of Insert Mode
<ctrl>f
Moves the cursor forward a full page of text at a time
<ctrl>b
Moves the cursor backward a full page of text at a time
x
Deletes the character under the cursor
dd
Deletes the line where the cursor is located (type d twice!)
n dd
Delete n consecutive lines ( n is an integer)
u
Undoes the last edit operation
yy
Copies or yanks a line ( 5yy yanks 5 lines)
p
Puts the yanked text on the line below the cursor (lower case p)
P
Puts the yanked text above the current line (capital P)
Note: If vi is already in the input mode, text from that or another window may be highlited using the left mouse button, and copied into place by pressing the middle mouse button.
: r <file>
reads a file from disk into the vi editor
: w <file>
writes current file to disk
: wq
writes the file and quits vi
: q!
quits without writing (useful if you've messed up!)






No comments:

Post a Comment