Skip to content

Instantly share code, notes, and snippets.

@thieu1995
Created May 17, 2020 00:17
Show Gist options
  • Save thieu1995/3de1b1ee4d66cc5c4b797fc431c2f430 to your computer and use it in GitHub Desktop.
Save thieu1995/3de1b1ee4d66cc5c4b797fc431c2f430 to your computer and use it in GitHub Desktop.
List of useful command line in linux
# Remove files/folders
rm -rfv folder
rm file_* # *: pattern
rm -v folder/* # Remove all child file in that folder
# Determine file size, all file size in folder
du -sh foldername/filenames
# Watch GPU memory usage in linux
watch -d -n 1 nvidia-smi
# Get list of process running on core
ps -A -o pid,psr,args #(pid - core - command line)
ps -A -o psr,pid,args | grep '^ *1' #(core - pid - command line) --> Get list of process running on this core
# Copy folder in real, not linked
cp -r path1 path2
# Cound number of lines in filer/file in folder
wc -l filename/folder_name
# scp server to server
scp -r source_path_file/folder ip_address/name:path_to_file/folder
# scp multiple files in folder without overwrite --> sync between 2 folder
rsync -au source_path_folder ip_address/server_name:path_to_folder
rsync -a --ignore-existing source_path_folder ip_address/server_name:path_to_folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment