Linux Command

Frequently used linux commands

Linux Quick Start

grep file ignoring case

1
ls -la | grep -i "pypdf2"

change user password

1
sudo passwd username

remove package

1
2
3
4
5
6
7
8
sudo apt-get purge PackageName

# if your ubuntu have GUI, you can delete the gui by the following command, and reboot
sudo apt-get purge lightdm

# if you want to recover your GUI, you can install it and reboot
sudo apt-get install lightdm
reboot

ftp common command

1
2
3
4
5
6
7
8
# check ftp service status
service vsftpd status

# check ftp process
ps ef | grep -i ftp

# display ftp auto-on process
systemctl list-unit-files | grep ftp

system service

1
2
3
4
5
6
7
8
9
10
11
# start ftp service
systemctl start vsftpd

# stop ftp service
systemctl stop vsftpd

# set ftp auto-on on
systemctl enable vsftpd

# set ftp auto-on off
systemctl disable vsftpd

display folder size

1
du

compressed folder

1
2
3
# SML_P1.tar.gz is the name of target compressed file
# SML_P1/ is the folder you want to compress
tar -zcvf SML_P1.tar.gz SML_P1/

login other machine by ssh

1
2
# let us set ip as 192.168.1.1, port as 12345, user as root
ssh root@192.168.1.1 -p 12345

ssh other machine and run local shell script

1
2
3
# let us set ip as 192.168.1.1, port as 12345, user as root
# shell script as base.sh
ssh -T root@192.168.1.1 -p 12345 < bash.sh

copy file to other machine

1
2
3
# let us set ip as 192.168.1.1, port as 12345, user as root
# relative local file path ./FinalCode.txt
scp -P 12345 ./FinalCode.txt root@192.168.1.1:~/Documents

copy folder to other machine

1
2
3
# let us set ip as 192.168.1.1, port as 12345, user as root
# relative local folder path ./FinalCode/
scp -P 12345 -r ./FinalCode/ root@192.168.1.1:~/Documents

Reference

Common FTP Command

Ubuntu Auto-On Service