Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

Linux Commands

Uploaded by

rama091990
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Linux Commands

Uploaded by

rama091990
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

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

sed "s/he/hoo/i" seshu --only 1st one will change


set "s/he/hoo/gi" seshu --enti32re
sed "s/^$/seshuganesh/g" seshu --fill empty line with seshuganesh
sed -n '$p' seshu -lastline print
sed -n '1p' seshu
sed '2d' seshu --2nd line delete
sed '$d' seshu --last line delete
* [] ?
s*-begins with s

*U-end with u
s*u
S*S*u

ls [abcdef]eshu--match with any letter


ls []
top
yes?/dev/null&---to change cpu usage hikes
df
df -a --complete file system extra file system
df -h
df-Th --type of file system
df -k ---kilobytes
df -m mega bytes
df -t ext4
df -t tmpfs --temporary
df -x ext4
df --h ==help
----------
shell scripting
vi s.sh
#!/bin/bash
ls
:ZZ
./s.sh
chmod +x s.sh
vi samplescript.sh
#--comment
touch d e f
chmod +x samplescript.sh
./samplescript.sh
ls
vi script3.sh
echo "what is your name"
./script3.sh

v="hello"
echo $a

====

echo "what is your name"


read name
echo "how do you do,$name?"
read remark
echo" iam also $remark tooo"

==============
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
===============

You might also like