UNIX Commands (2) ================= Transfer files among hosts -------------------------- Send a file from local host to a remote host (VM in this time) via ssh. The file is saved in the HOME directory on VM:: $ scp -i ~/.ssh/info0940_id_rsa -P 6543 FILE_NAME student@127.0.0.1: Send a file from a remote host (VM in this time) to local host via ssh. For FILE_NAME, you can specify the full path, or relative path. The last argument "./" is the directory path to place the downloaded file:: $ scp -i ~/.ssh/info0940_id_rsa -P 6543 student@127.0.0.1:FILE_NAME ./ If you wish to send a directory, please add "-r" option.:: $ scp -r -i ~/.ssh/info0940_id_rsa -P 6543 DIRECTORY_NAME student@127.0.0.1: If you wish to receive a directory, please add "-r" option.:: $ scp -r -i ~/.ssh/info0940_id_rsa -P 6543 student@127.0.0.1:DIRECTORY_NAME ./ OS Information -------------- Show OS kernel version.:: $ uname -a Show CPU information:: $ cat /proc/cpuinfo Show OS processes 1:: $ top Show OS processes 2:: $ ps aux Show network interface information:: $ ip addr Show memory utilization:: $ free Text processing --------------- Print lines including PATTERN:: $ (do output) | grep PATTERN grep example: showing CPU model name, and removing other info from /proc/cpuinfo:: $ cat /proc/cpuinfo | grep "model name" Advanced grep example: printing only the first line using awk. awk is a text processing language. awk is complicated but quite useful. Please look into it if you are interested in.:: $ cat /proc/cpuinfo | grep "model name" | awk 'NR==1' File search ----------- Print lines FROM FILES UNDER CURRENT DIRECTORY including PATTERN:: $ grep PATTERN -r ./ Find a file named FILE_NAME under current directory.:: $ find ./ -name FILE_NAME -ls