Some tips for the Linux shell command.
Nav
pwd | absolute path of the actual repertory |
---|
ls | list of files and repertories |
---|
cd | go in the repertory |
---|
mkdir repertoryName | create a new repertory |
---|
cp -r -v originalRepertory new Repertory | recursive copy of a repertory |
---|
rm fileToBeDeleted | delete file |
---|
rm -rf repertoryToBeDeleted | delete recursively a repertory |
---|
mv originalFile newFile | move file |
---|
sudo | before command for use the administrator |
---|
Weight
du -sh RepertoryName | display the weight of a repertory |
---|
df -h | free space of the disks |
---|
Process
ps | list of the process running |
---|
ps -e | list of all the process of the system |
---|
ps -e -o"%p %P %U %c" | display PID, PPID (parent PID), user, program |
---|
Program
g++ -o programName sourceName.cpp | compile C++ |
---|
g++ sourceName.cpp -lpthread -o programName | compile C++ with library |
---|
./programName | execute C++ |
---|
(ctrl)+c | close the program |
---|
./programName & | run an unclosable program |
---|
USB
ls -l /dev/disk/by-id/*usb* | identify the USB input |
---|
sudo mount -t ext3 /dev/sdb /media/INTRASAVE | mount an USB key |
---|
umount /media/RepertoryName | umount the USB |
---|
sudo fdisk -l | find an USB key |
---|
lsusb | |
---|
SSH
scp originalFile userName@serverIP:/path | push a file in SSH |
---|
scp -r repertoryName userName@serverIP:/path | push a repertory in SSH |
---|
scp -r userName@serverIP:/path repertoryName | pull a repertory in SSH |
---|
Update
apt-get update | update depots database |
---|
apt-get upgrade | update the system |
---|
apt-cache search software | search exact name of a software |
---|
apt-get install software | download and install a software |
---|
MySQL
mysqldump -u user -pPassword --all-databases > ~/fileName.sql | save all databases, User can is root and password empty |
---|
User
adduser userName | create an user |
---|
mkdir /var/www/dirName
usermod -d /var/www/dirName userName
chown userName /var/www/dirName | change the main directory of the user |
---|
sudo mount --bind /var/www/dirName /home/userName | change the default ftp landing directory |
---|