Linux Commands
Linux Commands
ls
2. mkdir
3. cd
4.touch
5.nano vimac vi
6.cat 1.txt
7.create and open nano 2.txt
8.touch t1.txt 2.txt
9.rm ,rm *
10. cd ../.. --two folder back
11.mkdir test3 && cd test3
12.cd without any dot it will go home
13. rmdir test3/
14. rm -r test1/ content also
15. rm -d test1 remove empty
16. cp 1.txt test1/
17. mv 2.txt test1/
18. mv 3.txt ~/app/
19. clear
20. mv 1.txt mynewfille.txt to rename the file
21.apt to install any package,yum,
22.man
23.uname
24.apt -get different Linux
25. sudo superuserdo having all access
26. sudo apt update && sudo apt upgrade
27. sudo apt purge
28. ssh -i demokey.pem ubuntu@44.203.86.26
29. sudo apt update
30.pwd
31.ami
32.which docker
33.date
34.ping goggle.com
35.ip address
36. nslookup google.com
ipaddress
37. curl google.com html format
38.wget https:// todownload
39. grep hi to search,grep -v hi first >five
40.sort,sort -n numeric sort
41. wc ,wc -w ,wc -l ,wc -c,
42,egrep exact grep
43.awk for column
awk '{print}' details
awk '{print $0}' details
awk '{print NR,$0}' details all coulumn with num
awk '{print $NF}' details last column
awk '{print $1,$3}' details first and 3rd column
awk 'NR==1,NR==2 {print $0}' details
awk '/ab/{print $0}, details
44.useradd seshu
cat /etc/passwd for checking users
su seshu
passwd seshu
groups seshu
usermod seshu
usermod --expiredate 2020-10-30 seshu
groups seshu
id seshu
groupadd games
usermod -a -G ganeshu seshu
groups seshu
cat /etc/group
groupadd cat
groupadd dog
useradd pet
usermod -a -g cat,dog pet
sudo apt-get install apache2
service apache2 start status
touch f1 f2
zip -r f f1 f2
rm f1 f2
unzip f
cat seshu
1 3 13
2 5 12
4 7 11
6 9 10
cut -f 1 seshu --display 1st column
cut -f 2 seshu --display 1st column
cut -f 1-3 seshu --display 1st column
paste f1 f2 f3 --merge three files
paste -d ";" sehu ganesh
paste -s seshu --print single line
paste -d ";" -s seshu separate by single column with ,
paste -d ";" -s seshu ganeshu
*U-end with u
s*u
S*S*u
v="hello"
echo $a
====
==============
a=10
b=20
if [ $a == $b ]
then
echo "a is equal to b"
fi
if [ $a !=$b ]
then
echo "a is not equal to b"
fi
=============
a=10
b=20
if [ $a == $b ]
then
echo "a is equal to b"
else
echo "a is not equal to b"
fi
================
car="bmw"
case"$car"in
#case1
"Lambo") echo "headquarted in usa";;
#case2
"bmw")echo "headquarted in india";;
#case3
"fotuner") echo "headquarted in germany";;
esac
======================
for a in 1 2 3 4 5 6 7 8
do
if [$a==5]
then
break
fi
echo "iteration number $a"
done
===============
for a in 1 2 3 4 5 6 7 8
do
if [$a==5]
then
continue
fi
echo "iteration number $a"
done
=======================
vi script.sh
a=0
while [$a -lt 10]
do
echo $a
a='expr $a+ 1'
done
===============
echo"program to find Fibonacci series"
echo"how many no of terms to gernrated"
read n
x=0,y=1
i=2
echo "Fibonacci series upto $n terms"
echo "$x"
echo "#y"
while [ $i -lt $n ]
do
i='expr $i+ 1'
z='expr $x+$y'
echo "$z"
x=$y
y=$z
done
===============