Skip to content

Instantly share code, notes, and snippets.

@misteio
Last active August 18, 2021 11:11
Show Gist options
  • Save misteio/5ec13244cf55c52dec9a to your computer and use it in GitHub Desktop.
Save misteio/5ec13244cf55c52dec9a to your computer and use it in GitHub Desktop.
Bash Commands
##install deb file
sudo dpkg -i *.deb
## In real time info
tail -f fichierdelog
###Change time
sudo ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
###DUMP SQL AMAZON
mysqldump -u user -p database -h XXX.eu-west-1.rds.amazonaws.com --port=3306 --databases database > rds-dump.sql
### DUMP SQL with ignore tables
mysqldump -u root -p brandcenter-pp --ignore-table=brandcenter-pp.tree --ignore-table=brandcenter-pp.logs > database.sql
###RSYNC DIST + KEY + Exclude DIR
rsync -avz --exclude _tmp --exclude log -e "ssh -i /home/agence/rsynckey" [email protected]:/data/www/brandcenter.pp/ /home/agence/testrsync/1/
##Synchronize RSYNC
rsync -r -a -v -e "ssh -i /home/agence/rsynckey" --delete /home/agence/testrsync/2/ [email protected]:/data/www/bbbb/
### Add service to start mysql
chkconfig --add mysqld
ou
chkconfig mysqld on
et pour vérifier chkconfig --list
### Access to sudousers + verify automagically if file is good
sudo visudo
## Edit Crontab ou avec le SU : sudo !!
crontab -e
## See current user crontab
crontab -l
## in Crontab you can use @reboot
## See available space on disk
df -H
## See precisly
df -h | grep /dir | awk '{ print $4; }'
## More precisly
df -h | grep /dir | awk '{ print $4; }'| cut -d "%" -f 1
## Add a existing user to existing group
usermod -a -G group user
#######Configure a SFTP access
[root@ip-172-XX-X-XXX /]# adduser username -G apache
[root@ip-172-XX-X-XXX /]# su username
[username@ip-172-XX-X-XXX /]$ cd /home/username/
[username@ip-172-XX-X-XXX ~]$ mkdir .ssh
[username@ip-172-XX-X-XXX ~]$ nano .ssh/authorized_keys (and copy public key)
[username@ip-172-XX-X-XXX ~]$ chmod 600 .ssh/authorized_keys
[username@ip-172-XX-X-XXX ~]$ chmod 700 .ssh/
[username@ip-172-XX-X-XXX ~]$ exit
#####To check the configuration files for syntax errors run:
# Fedora, RHEL, CentOS, OSX
httpd -S
# Debian, Ubuntu
apache2ctl -S
#find exectutable program
which ffmpeg
#Verify configuration file
php -i | grep 'Configuration File'
#Verify extension loaded
php -i | grep 'Mongo'
#lance la commande avec le bon php.ini
php -c /etc/php5/apache2/php.ini app/console doctrine:mongodb:schema:create --index
#Del user with home
userdel -r username
####config xdebug
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.idekey=xdebug
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_log="/tmp/xdebug_remote_log.log"
xdebug.extended_info=1
##Swap config
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
##Know space and navigation
ncdu /
#clear cache composer
rm -rf "`composer config cache-dir`"
#know size of directory
du -hs /path/to/directory
#List all processes
ps -ef
#add service on startup
sudo update-rc.d service defaults
#list all connected network devices
--localnetsudo arp-scan --interface=wlxc05627d33d78 --localnet
#start service on startup
sudo update-rc.d service enable
#lock screen
screen -ls
#retrieve screen
screen -r idscreen pour le reprendre
#create bootable key
sudo dd if=/home/miste/Downloads/deepin-15.4-amd64.iso of=/dev/sdc1 bs=4M && sync
# it will show block device names:
sudo blkid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment