Weekend is over, rest day!
Organize your notes!
This is part of the sorting out...
Leave it out for next time...
Efficiency shortcuts
Switching the front and back of the shell
ctrl + z
can put a command that is executing in the foreground into the background, and pause
jobs
to see how many commands are currently running in the background.
fg
transfer the commands in the background to the foreground to continue running.
If there are multiple commands in the background, You can use fg %jobnumber to call out the selected command. %jobnumber is the serial number (not pid) of the command being executed in the background found through the jobs command.
bg
changes a command that is suspended in the background to continue execution. If there are multiple commands in the background, you can use bg %jobnumber to call out the selected command. %jobnumber is the serial number (not pid) of the command being executed in the background found through the jobs command.
debugging
Function: View dynamic library by
command: ldd
Example:
$ ldd /usr/bin/vim
linux-vdso.so.1 => (0x00007ffc69133000)
libSM.so.6 => /lib64/libSM.so.6 (0x00007f7c6769c000)
libICE.so.6 => /lib64/libICE.so.6 (0x00007f7c6747f000)
libXt.so.6 => /lib64/libXt.so.6 (0x00007f7c67218000)
libX11.so.6 => /lib64/libX11.so.6 (0x00007f7c66eda000)
libm.so.6 => /lib64/libm.so.6 (0x00007f7c66bd7000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f7c669ad000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f7c66786000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f7c66581000)
liblua-5.1.so => /lib64/liblua-5.1.so (0x00007f7c66353000)
libpython2.7.so.1.0 => /usr/local/lib/libpython2.7.so.1.0 (0x00007f7c65f4b000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f7c65d2e000)
libruby.so.2.0 => /lib64/libruby.so.2.0 (0x00007f7c658d1000)
libc.so.6 => /lib64/libc.so.6 (0x00007f7c6550e000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f7c65308000)
libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f7c650e0000)
/lib64/ld-linux-x86-64.so.2 (0x0000558b9a610000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f7c64e7e000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f7c64c7a000)
librt.so.1 => /lib64/librt.so.1 (0x00007f7c64a72000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f7c6483b000)
libXau.so.6 => /lib64/libXau.so.6 (0x00007f7c64636000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007f7c64433000)
Function: Code debugging
Command: gdb
Example:
Open the gui window while debugging proc_path
gdb proc_path --tui
Resource upload and download
scp
uploads local files to the server downloads files
scp upload_file user@host:/upload_path/
from the server The
scp user@host:/download_file down_path
above are the commands for uploading and downloading ordinary files. For uploading and downloading directories, you only need to add the -r option
. Upload the directory to
scp -r upload_dir user@host:download_path
the server and download the entire directory from the server.
scp -r user@host:/dowload_dir download_path
netcat
download from remote machine to local
# 远程机
nc -l -p port < file
# 本地机
nc host port > get-pip.py
lrzsz
lrzsz need to use GUI remote client like xshell, securecrt, iterm2 etc.
# centos / fedora
yum -y install lrzsz
Upload file from local machine
rz file
to machine Download file from remote machine to local machine
sz file
unzip
Do not compress & decompress
tar -cvf file.tar file
tar -xvf file.tar
gzip compression & decompression
tar -zcvf file.tar.gz
tar -zxvf file.tar.gz
bzip2 compression & decompression
tar -jcvf file.tar.gz
tar -jxvf file.tar.gz