为生活!

这一天,
放下挂念,
开始新的旅程!
再见了,
所谓的爱情!

Linux Commands (Day 1)

(1) Change file permissions

chmod 644 filename ## assign the file read/write by the owner and only read by everyone else (-rw-r--r--).

chmod -R 644 foldername ## assign all the files in the folder read/write by the owner and only read by everyone else (-rw-r--r--).

r:
400 read by owner
040 read by group
004 read by anybody (other)

w:
200 write by owner
020 write by group
002 write by anybody

x:
100 execute by owner
010 execute by group
001 execute by anybody

(2) Secure copy files between Linux hosts

scp user@remote-computer:/remote-path/remote-file /local-path/local-file ## copy a file from a remote computer to the computer you are working at.

scp -r user@remote-computer:/remote-path/remote-directory /local-path/local-directory ## copy a folder from a remote computer to the computer you are working at.

scp /local-path/local-file user@remote-computer:/remote-path/remote-file ## copy a file from the computer you are working at to a remote computer.

scp -r /local-path/local-directory user@remote-computer:/remote-path/remote-directory ## copy a file from the computer you are working at to a remote computer.

(3) Control jobs

jobs ## list jobs.
%1 ## resume the first stopped job.
fg %1 ## resume the first stopped job.
%1 & ## put the first stopped job into background.
bg %1 ## put the first stopped job into background.
kill %1 ## terminate the first stopped job.
nohup myjob.sh & ## run myjob.sh in the background as a process detached from the console and send output to nohup.out by default.
script...exit ## start a new shell and log all the output into the file called typescript.

(4) Capture outputs

(((./cmd | tee stdout.txt) 3>&1 1>&2 2>&3 | tee stderr.txt) 3>&1 1>&2 2>&3) 1>out.txt 2>err.txt ## see explanation at http://www.cpqlinux.com/redirect.html.

(5) Emacs tutorial