revision
1. cd :-
changing the directory
cd . -> present directory
cd .. or cd ../ -> go one directory backward
cd --> go to root directory
if you have space in directory name you can use 'folder name' within single quote
or else you can use \ b/w two names
ex New folder
cd 'New folder'
cd New\ folder
2. pwd:-
present working directory
3. ls:-
list the current directory contents both directory and files
options:-
-a -> list all the contents,do not ignore entries starting with .
-l -> long listing format
-t -> sort by modification time, newest first
-r -> reverse sort
-h -> display the size in human readable format
4. man:-
open the manual page for the command
example:- man ls
5. chmod:- ( change mode bits)
change the permission of (i) primary user (ii) group user (iii) others
types:-
1.chmod 3 numbers
2.chmod user based updates
option - R
ex:-
chmod 741 file/dirname
primary_user -> rwx
group_user ->r--
others ->--x
chmod u+r -> gives read permission for user
chmod u=rw -> gives read write permission as designate permission
for user and remove pervious permission
chmod u-rw -> removes read and write permission for user
6. sleep:- it pauses the execution of command for given time duration
7. date:- machine current date and time will be displayed
8. cp:-
files ->
copy file/dir from source to destination
cp <dir_path>/source_file_name <dir_path>/destination_dir_name
directory ->
cp -r <dir_path>/source_dir_name <dir_path>/destination_dir_name
option ->
-r -> recursive
-f -> force full
9. mv ( cut and paste)
a. move source file/dir to destination
files ->
mv <dir_path>/source_file_name <dir_path>/destination_dir_name
directory ->
mv <dir_path>/source_dir_name <dir_path>/destination_dir_name
b. rename:-
renmane existing file/dir to new name
syntax ->
mv <dir_path> old_file_name/old_dir_name <dir_path>
new_file_name
here both source and destination dir_path should be the
same
10. mkdir:-
make/create directory
synatax
mkdir <dir_path> dir_name
option:-
-p parent directory
ex:-
mkdir -p dir1/dir2/dir/3
creates dir1 within dir2 creates dir2...
11. touch:-
create new file
touch filenmae.ext
ex:-
touch .memory.v
.-> creates hidden files
12. rm:- (delete)
a. files:-
rm file_name.ext
b. directory
rm -r dir_name
rmdir dir_name
13. alias:-
giving short notation for very log path
alias shortnotation="longcommand"
14. text display commands:-
cat -> display entire file content in to the terminal
head
tail
more
less
15. $path:-
it contains directory path which my shell looks for when ever we
execute exe file
echo $path:-
display the directory path of $path
how to update $path
PATH="$PATH:<dir_path>" --> bourne shell
set PATH ($PATH/cygdrive/d) ---> tcsh shell
16. gives the current shell type
17. pipe( |) to merge two more commands
command1 | command2 | command3
18. redirecting >:- output of command if we wnat to store in file we use
redirecting command
command > file_name.ext
19. pushd popd:-
push the directory path in stack (LIFO)
syntax:- pushd .
syntax:- popd
20. ps1:-
how to interact teminal with user we use ps1
\u
\w
\W
\d
\t
\#
\n
\s
\h
21. to open file we have to use appl name
vi
gvim
emacs
22. which:-
to check any appl is installed in linux we use which command
23. find:-
locates given file name or directory
find . -name "file_name/dir" -type f/d
24. grep:-
search a given pattern in given file
options:-
-i
-v
-o
-w
-l
for more details refer to manual
synatx:-
grep [options] filename
25. sed:-
stream editor
text editor
replace.. delete..addd
sed [option] 'sed commands' filename
26. xarg:-
xargs takes output of previous command gives it as input to
next command
27. awk
it is used for database management
28. ping:-
check the network strength with connected server
29. passwd:-
change user desktop password
30. history:-
display all the command previously used it has some limitation of
500
31. ps:-
report the process information that are currently running in linux
32. Suspend the process
Kill PID