Linux Commands

ls

  • d /etc/ssh/ssh_config
  • vim /etc/ssh/ssh_config
  • vi /etc/ssh/ssh_config
  • ls
  • mkdir test
  • ls
  • ll
  • su test/
  • ll
  • chmod test:test test/
  • chown test:test test/
  • ll
  • cd ..
  • ll
  • ped
  • pwd
  • ll
  • chown test:test root/
  • ll
  • ip a
  • ip r
  • ip a
  • dhclient
  • ip a
  • ip r
  • ps -ef | grep 22
  • vi /etc/ssh/ssh_config
  • service ssh restart
  • service sshd restart
  • ps -ef | grep ssh
  • kill -9 2825 2988
  • ps -ef | grep ssh
  • vi /etc/ssh/ssh_config
  • service restart sshd
  • service restart ssh
  • service
  • service ssh
  • service sshd
  • sudo service sshd
  • ip a
  • ip a del 192.168.177.128/24 brd 192.168.177.255 dev eth0
  • ip a
  • dhclient
  • ip a
  • sudo service ssh
  • apt-get install openssh-server
  • sudo service ssh
  • sudo service ssh restart
  • sudo service ssh status
  • history

=====================================================================

ctrl +alt+ t (for terminal shortcut)
exit (to quit terminal)

locale
cd /usr/shar/i18n/locales/
less en_CA
localectl status
localectl list-locales/
localectl set-locale LANG=en_CA.utf8
clear

echo $PWD
echo PWD
env
env | less
Q (To exit less)

——–
myval = 5
echo $myval
———

bash
echo $myval
exit

export myval
bash
echo $myval

history (.bash_history contain a record on last 1000 command run)

type wget

timedatectl
timedatectl list-timezones | grep -i america
timedatectl set-timezone Canada/Toronto

df -ht ext4
lsblk | grep sd
mkdir /media/newplace
sudoe mount /dev/sdb2 /media/newplace

dmesg
dmesg | grep wl
sudo lshw | less

cd /etc/apt
less source.list.short
cd sources.list.d/
ls
apt list –all-version | wc

sudo apt update
apt search business card | less
apt show glabels
sudo apt install glabels or sudo apt-get intall glabels

yum list vino
yum info vino
yum install vino

systemctl get-default (to get linux current run level)
systemctl isolate rescue.target (open linux in recovery session)
systemctl enable multi-user.target

sudo apt install man-db
sudo apt update
sudo apt install info
info
info wget example samples
cd /usr/share/doc/wget/
ls
wget –help
wget –help | less
type wget

when terminal is ope it creates a .bashrc file in home directory-path
ls -a
ls
less .bashrc (contains information about terminal)

less .profile (when connecting through ssh)
less /etc/profile

ls -all
man ls
ip addr
ip a

touch this is my story
rm *
touch “this is my story”
touch another\ four\ word\ name
touch another-four-word-name

cd /home/ubuntu/scripts
pwd
mkdir data
cd data
ls
nano file1 (ctrl x and Y)
touch file2
touch file3
touch file4
touch file5
mkdir newdata
cp file1 newdata/
cp file* newdata/
cd newdata
ls
touch file11
touch file12
rm file?
ls
rm file*
ls
mv ../file* .
ls
rm *
cd ..
rmdir newdata/

locate adduser
nano /etc/adduser.conf
sudo updatedb

cat /etc/group | grep ubuntu
cat /etc/group | grep ubuntu >> newfile (create and append content to the existing file)
cat /etc/group | grep ubuntu > newfile (overwrite content)

head /etc/group (first 10 line)
tail /etc/group (last 10 line)

cut -d: -f3 /etc/group
cut -d: -f3 /etc/group sort -n (ascending sort)
cut -d: -f3 /etc/group sort -r (descending sort)

wc /etc/group

mysql -u root -p < mydatabase.sql (standard input) cat /etc/group | grep ubuntu >> newfile (standard output)
wget redifffff.com 2> errorfile.txt
cat errorfile.txt

wget wordpress.org/latest.zip
tar xzf latest.tar.gz
ls
cd wordpress/
ls
cd..
tar czf newarchive.tar.gz wordpress/
tar czf largearchive.tar wordpress/
ls -l
gzip largearchive.tar
ls -l

zip newname.zip *
unzip akismet.4.1.zip

lsusb
lspci
sudo lshw
sudo lshw > lshw-output
less lshw-output
ls /lib/modules
uname -r

ip route show
sudo dhclient
ip addr
route
netstat -i
netstar -l
ss -i

host bootstrap-it.com
ping 8.8.8.8
cat /etc/resolv.conf
systemd-resolve –status
sudo nano /etc/hosts

apt install openssh-server or yum install openssh-server (on server)
apt install openssh-client or yum install openssh-clients (on client)
ssh ubuntu@10.0.31.131
ssh -p 2222 ubuntu@10.0.31.131
ssh -i /home/myusername/mykeyfile.pem ubuntu@10.0.31.131
scp update-local.sh ubuntu@10.0.31.131:/home/ubuntu
exit
cd /etc/ssh
ls

pwd
clear
cd ..
cd | cd ~
cd /
cd ‘xx yy’ } cd “xx yy”

echo x

x=100
echo $x

su | sudo -i
su username

exit | logout

sudo ls
ls /
ls
ls /home/test/desktop
ls -l
ls -a
ls -author
ls -S
ls -laS
ls *.html
ls -laS /home/test/desktop > File1.txt
vi File1.txt

cat File1.txt
cat File2.txt (ctrl+D to save and exit)
cat file1.txt file2.txt

cat File1.txt >> File2.txt
cat -n File1.txt
cat -b File1.txt
cat -s File1.txt
cat -E File1.txt

grep options File1.txt
grep -i options File1.txt
grep -n options File1.txt
grep -v options File1.txt
grep -c options File1.txt

sort File1.txt
sort File1.txt File2.txt
sort -r File1.txt
sort -f File1.txt
sort -n File1.txt

grep dh file1.txt file2.txt | sort
grep dh file1.txt file2.txt | sort -r

cp [options] source destination
cp
cp -i
cp -n
cp -u
cp -R
cp -v
cp *.txt

mv [options] source destination
mv
mv -i
mv -u
mv -v
mv *.txt

mkdir directory-path
mkdir -p
mkdir –parents
mkdir -p file1/{f2,f3,f4}

rmdir foldername
rm filename/ foldername
rmdir
rmdir -p
rmdir -pv
rm -r
rm -rp

chmod g+wx filename
chmod u=rwx,o-wx filename

chown username filename
chown username:groupname filename

chgrp groupname filename

cd /proc
ls
less meminfo
less cpuinfo
top
free -h
df -ht ext4
ps
ps aux
sudo systemctl status apache2

/etc/shadow (contain encrypted version of user password)
sudo less /etc/shadow
sudo less /etc/passwd (user inforation)
less /etc/group
id steve
who
w
last

sudo useradd -m jane
cd /home/jane
ls
ls -a
/etc/skel/
ls
ls -a
sudo passwd jane

sudo mkdir /var/secret
sudo groupadd secret-group
sudo chown: secret-group /var/secret
sudo usermod -a -G secret-group jane
chmod g+w /var/secret/

cd /var/secret
su jane
touch data.txt
touch /var/log/stuff (got permission denied error)
ls -l
ls -dl
sudo chown ubuntu:secret-group /var/secret/
chmod o+x
chmod 777 data.txt
sudo chmod +s /var/secret

nmap -v -sT localhost
systemctl disable apache2
nmap -V -sT google.com