Professional Documents
Culture Documents
commands:-
1. pwd
2. mkdir
create a directory
mkdir dir_name
mkdir <dir_path>/dir_name
example:-
mkdir -p a/b/c/d
Q. step1:-
using mkdir command create a directory called as example
step2:-
in example using parent directory command create directory as
-INDIA
-KARNATAKA
-
BANGALORE
-HEBBAL
Ans:-
mkdir -p INDIA/KARNATAKA/BANGALORE/HEBBAL
3. ls
-l
long listing format
-t
sort based on modification time(newest first)
-r
reverse order sorting
-a
list all contents of cuurent dir(even the hidden files)
-h
display the size of files in human readable format
example:-
ls -ltrha
4. cd
cd [change directory]
cd . -> be in the current directory itself
cd .. or cd ../ -> go to previous directory
cd ~ or cd -> go to root directory or user path
Q. my pwd ->
cygdrive/d/PERSONAL/NOTES/SYSTEM_VERILOG/1.APB_MEMORY/mem_tb_development
I want to go 4 steps backward what is the command to be used.
5. touch
create a file of any extension
touch filename.extension
//creates a file in current directory itself
touch <dir_path>/filename.extension
Ans:-
touch /cygdrive/d/unix_april/dir1/lab_session/full_adder.v
or
touch unix_april/dir1/lab_session/full_adder.v
Ans:-
touch unix_april/dir1/lab_session/full_sub.v
unix_april/dir1/a/b/c/d/half_sub.v
Ans:-
touch /cygdrive/d/unix_april/dir1/abc.txt
/cygdrive/d/unix_april/dir1/xyz.txt
or
touch 1.txt 2.txt 3.txt 4.txt
o cat
display the entire file content on to the terminal
cat filename.ext
-n to display line numbers
example:-
$ cat -n full_adder.v half_adder.v full_sub.v
1 module
2 //this is a full_adder.v file
3 endmodule
4 module
5 //this is a half_adder.v file
6
7 endmodule
8 module
9 //this is a full_sub.v file
10
11 endmodule
o head
display the 1st 10 lines from top of the file in to the terminal
head filename.extension
example:-
Q. display 1st 5 line of the file.
Ans:-
head -5 filename.extension
o tail
display the last/bottom 10 lines from of the file in to the terminal
tail filename.extension
example:-
Q. display last 5 line of the file.
Ans:-
tail -5 filename.extension
o more
display the file content screen by scrren on to the terminal
more filename.txt
o less
we flexibility of scrolling (similar to more command)
7. mv
move file or move directory(simar to cut and paste operation in windows)
mv <dir_path>/source <dir_path>/destination
source can be file_name or dir_name
destination can be dir_name
example:-
Q. create two directory called as demo1 and demo2
create two to three random file in both the directory(i.e demo1
and demo2)
-> in demo1
create files such as add.txt sub.txt mul.txt
write some random content into them
-> in demo2
create files such as agent.sv env.sv
write some random content into them
Q.
mv /path/demo1/add.txt demo1/sub.txt demo1/mul.txt path/demo2
12. history
13. ping
16. vi
17. rm
18. rmdir
19. wc
20. nl -> not important
21. chmod
22. uniq -> not important
23. grep
-c
-w
-i
-r
-o
-l
-h
-n
-v
-e
24. ls
-l
-a
-r
-h
-t
25. meta char
*
?