# Create symbolic linkln -s /path/to/original /path/to/symlink└───────┬───────┘└── the path to the original file/foldercan use . or ~ or other relative paths
# Copy directory & contents to another place (-r for recursive)cp -r /path/to/dir /path/to/wheretocopy
# Preview output of script.# Piping things into less will preview the contentcurl https://21.co | less
# Move everything from one dir to another.# i.e. move all files in Downloads to Desktop. * after folder means select everythingmv -v ~/Downloads/* ~/Desktop/
# Get full path to filerealpath <file>
# Do regex replace (with perl) on a fileperl -pi -e "<regex>" <file># i.e.perl -pi -e "s/^\s*\{[^\n']*'([^\n']*)'[^\n']*'([^\n#']*)#[^\n']*'[^\n'}]*\},?/'\1', '\2'\n/gm" triggers.js
# Download URL contentscurl -0 <url>
# Give executable permission to file.chmod a+x <file>
# Discard output of command.# Will direct ln cmd output to null device that will delete anything written to it.ln > /dev/null
# See how unicode string is encoded internally.# https://wiki.soimort.org/unix/cli/echo hello | hexdump -C# See how it is encoded in UTF-16: (assume UTF-8 is default encoding)echo hello | iconv -f utf-8 -t utf-16 | hexdump -C
# Search for occurrence of word in a file.# i.e. show all occurrences of word fox in file story.txtgrep 'fox' story.txt
# Search whether a string occurs in a directory# -l = print filenames of matching filesgrep -rl "string" /path