Hi guys, I am writing series of
article on Big Data. Industry mostly uses Linux or Unix for deploying their Big
Data solution. So here I am covering some basics of Linux-
In Linux most of the work is done with
command prompt, for this we use terminal. Other works are done with editors, it
is same like notepad in windows.
Please find some useful commands and
their use-
Sno.
|
Command
|
Use
|
|
1
|
pwd
|
Print working directory
|
|
2
|
ls
|
List
|
|
3
|
ls -a
|
All listing
|
|
4
|
ls -al
|
All listing having permission to
user
|
|
5
|
ls -alh
|
Human readable a long listing like
4 KB size
|
|
6
|
cd <directory>
|
Change directory
|
|
7
|
mkdir <dirname>
|
Make directory
|
|
8
|
mkdir -p
<coolfolder/child/nested>
|
To create complete path
|
|
9
|
ls Desktop/Coolfolder<tab>
|
To get data
|
|
10
|
rm -r coolfolder
|
Remove recursive
|
|
11
|
rm -I coolfile.txt
|
To notify for remove
|
|
12
|
man <command>
|
Help or knowledge
|
|
13
|
touch <filename>
|
To create a file
|
|
14
|
mv tet.txt somefolder/
|
To move file
|
|
15
|
cp somefolder/text.txt
/testcopy.txt
|
To copy
|
|
16
|
mv test.txt newName.txt
|
To rename
|
|
17
|
cd ..
|
Move up a dir
|
|
18
|
cd ../..
|
Move two up
|
|
19
|
cd <home/username>
|
|
|
20
|
cd ~
|
To home dir
|
|
21
|
cat <filename>
|
To read file
|
|
22
|
cat <filename1>
<filename2>
|
To concat two files output
|
Editors :
1.
nano <filename>
i.
use ^X (ctrl+X) to exit, it will prompt to save the
file
ii.
^W to search some data
2.
vi <filename>
i.
for creating files
ii.
for modifying & appending some
text on already existing file
iii.
for displaying the content of file
iv.
use :wq to save and exit
v.
:q! to exit without save
Note : vi editior works on three
modes
Esc
mode (Press Esc)
Insert
mode (Press i)
Colon
mode (press shift + ;)
3.
emacs <filename>
i.
Fast & mostly used by
programmers
4.
vim <filename>
i.
Secure & mostly used by
sysadmins
Cat
command:
This
is one of the important command. It is mostly used for displaying the file
contents, but it has so many other uses too.
o
cat> for creating files
o
cat>> creating files if it is not exit or appending extra
text if it is already exist
user@machine:~$ cat > file.txt
Write your content here
o
Press ctrl+d to save and exit
o
Press ctrl+c exiting file without
saving
o
But you can’t change the content in
previous line