linux cmds
Table of contents
list dir
ls [options] <path>
### count files in dir ###
ls -1 | wc -l
### required ###
<path> path to directory
- empty: current dir
- ../ : previous dir
### options ###
-l : show details (permissions, last mod, link src ... )
-a : show all, including hidden
change dir
cd <path>
### special ###
cd # return to /home dir
cd .. # one hierarchy up
cd ../.. # 2 hierarchy up
cd <subdir> # goto subfolder
### legend ###
# <path> : full path of directory
# <subdir> : name of subfolder
move
move/rename files/dir
mv <old_path> <new_path>
### special ###
mv <old_name> <new_name> # rename, only if <new_name> not exists
mv <file_path> <dir_path> # move file to new dir, no change in name
mv <old_path> . # move file to current dir (name unchanged)
### legends ###
# <old_path> : path to old dir/file (full/relative)
# <new_path> : path to new location
# <old_name> : original name of file/dir
# <new_name> : new name of file/dir
# <file_path> : path to file
# <dir_path> : path to dir
softlink
create a shortcut link to source file / dir
ln -s <source> <link>
### legend ###
# <source> : full path to source file / dir
# <link> : full path to shortcut link
compression
compress file using following command
tar -[options] <archive_file> <source_file/folder>
tar -czvf <archive_file>.tar.gz <source_file/folder>
### options ###
# -c : create new archive
# -z : compress with gzip
# -v : verbose
# -f : flag archive filename
# -x : extract archived file
compare
gui
meld
tkdiff
terminal
- diff
meld
pros | cons |
gui | slow |
\>2 comparison | |
versatile: |
- dir
- text | |
meld <path0> <path1> ...
### legend ###
# <path?> : path of files / dirs
# ... accepts multiple files / dirs (of same type)
installation
tkdiff
pros | cons |
gui | text files only |
fast | limit to 2 comparison |
tkdiff<file0> <file1>
### legend ###
# <file?> : path of files
installation
diff
pros | cons |
built-in | limited # of lines |
limit to 2 comparison |
tkdiff<file0> <file1>
### legend ###
# <file?> : path of files