Linux: Change Read Only File System in Recovery Mode
Run the following command:
mount -o remount,rw /
Run the following command:
mount -o remount,rw /
Consider to insert one white space before and after English word in Japanese. Run the following script by changing a string 'YOUR_FILENAME'. The script copy the original file as YOUR_FILENAME.org and overwrite and replace the original file by inserting one white space before and after an English word. It is useful multi-byte language such as CJK (Chinese, Japanese and Korean).
export FILENAME='index.rst'; \
cp ${FILENAME} ${FILENAME}.org; \
cat ${FILENAME}.org | sed y/0123456789/0123456789/ | \
1. Adjust the time amongst the server in your system
ntpdate time.apple.com
2. Check and monitor your disk space
Your service may stop after one year from the beginning of your service release date because the log files occupies a server disk space.
Use logrotate to truncate the log files (even if you are practicing that, the logs will overflow at the server).
Monitor the remaining disk space by using df command.
df -h
There are a couple of options to add a user to group(s) in Linux. The commands are gpasswd, usermod and adduser.
I recommend to use gpasswd to add a user to group, which is no harm.
gpasswd -a <USERNAME> <GROUPNAME>
You must use usermod command as follows:
usermod -aG <GROUPNAME> <USERNAME>
Use a 'tag' command on docker.
docker tag <image_id> <repository_name>:<tag>
Note: You can omit the part '<tag>' and only write '<repository_name>'. The meaning of the <tag> string after colon (:) of the repository name is that you can put a different version image by changing the date or versions.
docker tag <image_id> <repository_name>
Edit /etc/crontab
vi /etc/crontab
Every end of the month
H 23 28-31 * * /usr/bin/test $( date -d '+1 day' +%d ) -eq 1 && <COMMAND>
Every last Friday of the month
0 0 * * 5 /usr/bin/test $( date +%m ) -ne $( date --date '7 day' +%m ) && <COMMAND>
These will be useful in Jenkins.
/usr/bin/test $( date -d '+1 day' +%d ) -eq 1
or
/usr/bin/test $( date +%m ) -ne $( date --date '7 day' +%m )
List volumes
sudo docker volume ls -qf dangling=true
Delete unnecessary volumes
sudo docker volume rm $(sudo docker volume ls -qf dangling=true)
Kill all Docker containers
sudo docker kill $(sudo docker ps -q)
Create the following script and run:
vi color.sh
chmod +x color.sh
./color.sh
The bash script:
#!/bin/bash
export txtrst='\x1b[00m' # Reset
echo
for i in {0..255} ; do
printf "\x1b[00;${i}m ${i}${txtrst}"
done
echo
echo
for i in {0..255} ; do
printf "\x1b[38;05;%03dm 38;05;%03d " ${i} ${i}
if [ $(( ${i} % 8 )) -eq 7 ] ; then
echo
fi
done
echo
To adjust timezone on your Linux to Pacific Standard Time (PST/PDT), type the following on command line.
sudo mv /etc/localtime /etc/localtime.org; sudo ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
To adjust timezone on your Linux to Japanese Standard Time (JST), type the following on command line.
sudo mv /etc/localtime /etc/localtime.org; sudo ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime