System Info

Neofetch is a command-line system information tool written in bash 3.2+. Neofetch displays information about your operating system, software and hardware in an aesthetic and visually pleasing way.

Neofetch has lots of dependency. An alternative is screenfetch.

lsb_release -a show linux release version and codename

Find Out Ram Speed, Make, Form Factor, Type and Other Information : dmidecode --type memory.

Configurate System

set timezone sudo dpkg-reconfigure tzdata

To change locale, use sudo update-locale LANG=en_US.utf8. Then ssh can show Chinese characters. In Ubuntu Server, “locale -a” say zh_CN.utf8. It is unusual. In Putty, “Connection → Data → Environment variables”, add LANG/zh_CN.utf8 & LC_CTYPE/zh_CN.utf8. Than Putty can type and show Chinese. Mac always ok on Chinese.

Package management

dpkg --get-selections | grep java find which package provides java command

TTY Device

screen /dev/ttyUSB0 115200 screen -L /dev/tty.SLAB_USBtoUART 115200 — will generate a log file screenlog.0 in current directory. To activate screen logging function, just press “Ctrl-A” and “H“. (Please be careful, we use capital ‘H’ letter. Using non capital ‘h’, will only create a screenshot of screen in another file named hardcopy). Ctrl-A, d — will detach from current, but screen still run background. Mac will not release TTL device. If want to attach again, use “screen -r”. Ctrl-A, : — will enter command mode, run “quit” will exit completely.

picocom -b 115200 -f h /dev/ttyS0 To exit, C-a, C-x compared with screen, picocom can view output history.

no permission to access tty device: sudo usermod -a -G dialout $USER sudo reboot

SSH sshpass -p “YOUR_PASSWORD” ssh -o StrictHostKeyChecking=no YOUR_USERNAME@SOME_SITE.COM ssh user@host «‘ENDSSH’ #commands to run on remote host ENDSSH

Example of .ssh/config

Host* f*
    User fedora 
    IdentityFile ~/.ssh/hp1_id_rsa 
Host f1 
Host * 
    User fan

More details about the config, check

“permissions are too open” error : chmod 400 ~/.ssh/id_rsa Sometimes ssh it very slow: Next authentication method: gssapi-with-mic Next authentication method: publickey 第一种认证方法浪费时间,可以在.ssh/config里面加上 PreferredAuthentications publickey。 或者GSSAPIAuthentication no

Connection closed by remote host due to inactivity

TCPKeepAlive yes 
ServerAliveInterval 10

Set it in client $HOME/.ssh/config file. Now all ssh connections will send a TCPKeepAlive every 10 seconds.

Unable to negotiate with host: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1 –> ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@host


show details when copy file: cp –verbose -rf /src/ /dsc/

rsync -avz –progress /path/of/source /path/of/target

A look at rsync performance rsync -a -v –ignore-existing a/ b/ –filter=’:- .gitignore’ –exclude=’/.git’

mount loop image file only this work for me

exclude all “permission denied” messages from “find” find / -name javac 2>/dev/null

chmod 755, 644, 700

who use this file : fuser file -v


Check SATA speed smartctl -a /dev/sda nvme-cli package sudo nvme list sudo nvme smart-log /dev/nvme0n1

Samba sometimes need create user: smbpasswd -a linuxsir. ‘root’ user is not permitted. Sometimes need “chmod 777 /mnt/sda1” if only read & can’t write. New samba looks having better UX: just add/append below to /etc/samba/smb.conf. Then ok. Restart is not need.


Ubuntu: netplan

Binary file

To list a binary dependency library: “ldd file”, or use “readelf -a file”.

run “readelf -a portal” and find line as below: [Requesting program interpreter: /lib/] Then run “ln -s /lib/ /lib/”.

readelf -a /usr/arm-linux-gnueabihf/lib/ grep FP


strings #print printable string.


$ heketi-cli -s volume list
Id:382bba388e29fbc9fdb3b53b96a203e0    Cluster:1f4e1ef2c5b292aec8cfe282222fa876    Name:vol_382bba388e29fbc9fdb3b53b96a203e0
Id:467863a2abe78ceb8b22dabf7d92c12f    Cluster:1f4e1ef2c5b292aec8cfe282222fa876    Name:vol_467863a2abe78ceb8b22dabf7d92c12f
heketi-cli -s volume list|grep -oP "Id:\K\w*"| xargs -L 1 heketi-cli -s volume delete

In line, “\K” means deleting the matching “id:” sting. “-L 1” means deleting every volume id. Otherwise, all lines will be executed only once. another way to run command within foreach.



Vim modify _vimrc in home directory:

set guifont=Cascadia_Code:h9
set guioptions -=T

CNTRL+ALT & F1 through F6 you have 7 virtual consoles the seventh is reserved for X.

Edit this file /etc/dhcp/dhclient.conf and set timeout to a reasonable value, like timeout 15 The default value of 300 seconds is way too high. The suggested replacement value of 15 was tested and works fine.

echo -n “STRING” | base64 -n is to avoid a new line character on the end of the line.

linux nohup

mutliply download: axel. It also can be used in OS X.

patch -p1 <~/patch1.diff

Most digital cameras and cell phone add EXIF metadata to the images. EXIF metadata includes camera specifications, settings, location (GPS coordinates) and more. exiftool -all= /.jpg -overwrite_original

STDERR (standard error) in UNIX and UNIX-like systems is redirected using 2> instead of a single chevron (>). gpc xxx.pas 2> error.txt