Skip to content

Instantly share code, notes, and snippets.

almokhtar almokhtarbr

Block or report user

Report or block almokhtarbr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View restart ssh centos
View docker commands
docker ps
// Also, you can restart your containers using the following command.
docker restart $(docker ps -q)
// You can kill all the containers using the following command.
docker kill $(docker ps -a -q)
// You can stop all the containers using the following command.
docker stop $(docker ps -aq)
// Now, again restart your container, if you have stopped your container.
docker-compose up -d nginx mysql phpmyadmin
// show only stopped containers
View worker php
command=php /var/www/artisan queue:work --queue=exports,default --sleep=3 --tries=3 --daemon
View php_network_getaddresses
DB_HOST=http://localhost/ --> DB_HOST=localhost
SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = crm and table_name = permissions and table_type = 'BASE TABL
View killed centos composer install
free -m
mkdir -p /var/_swap_
cd /var/_swap_
#Here, 1M * 2000 ~= 2GB of swap memory
dd if=/dev/zero of=swapfile bs=1M count=2000
mkswap swapfile
swapon swapfile
chmod 600 swapfile
echo "/var/_swap_/swapfile none swap sw 0 0" >> /etc/fstab
#cat /proc/meminfo
View telnet coffe machine
#!/usr/bin/env ruby
# Skip on weekends
exit if ||
# Exit early if no sessions with my_username are found
exit if `who`[/my_username/].nil?
require 'net/telnet'
View install docker in centos
$ sudo yum-config-manager --add-repo
$ sudo yum install docker-ce
$ sudo systemctl start docker
$ sudo docker run hello-world
# First of all it is required to configure Docker daemon to start automatically at system boot.
sudo systemctl enable docker
#And secondly, add your user to the docker group to get rid of the need of typing sudo each time you run the docker command:
sudo usermod -aG docker $USER
View Failed to set locale defaulting to C warning message on CentOS Linux when running yum
How do I solve this problem?
To set i18n stuff CentOS/Fedora and RedHat Enterprise Linux call a special script called /etc/profile.d/ Make sure this file exist in your system:
$ ls -l /etc/profile.d/
If file exist just call it:
$ source /etc/profile.d/
Verify that LANG and LC_* shell variable are set:
$ echo "$LANG"
$ echo "$LC_CTYPE"
View adding user in centos
adduser moktar
passwd moktar
# Use the usermod command to add the user to the wheel group.
usermod -aG wheel moktar
# Use the su command to switch to the new user account.
su - moktar
#As the new user, verify that you can use sudo by prepending “sudo” to the command that you want to run with superuser privileges
You can’t perform that action at this time.