less than 1 minute read

man (manual)

man <key> (manual)

pwd (print working directory)

pwd

ls (List files and directories)

ls 
ls <directory path>
ls -l (list long: detailed info)
ls -a (list all: include hidden files)

cd (change directory)

cd <directory path> 
cd . (current directory)
cd .. (upper directory)
cd ~ (home directory)
cd - (previous directory)

find

find <path> -type <file/directory> -name '*.txt' (find all text files)

which

which node
which code

touch and cat

touch new_file1.txt (make file)
cat new_file1.txt (print file content)

echo

echo <string> > file.txt (write string on file.txt)
echo <string> >> file.txt (append string on file.txt)

mkdir (make directory)

mkdir <directory path(name)>
mkdir -p <sub-directory path>

mv (move) and cp (copy)

mv <target> <path> (move location)
mv <target file> <file name> (change name)
cp <target> <path>

rm (remove)

rm <file>
rm -r <directory>

grep (global regular expression print)

grep <keyword> <file> (print which file and which keyword)
grep -n <keyword> <file> (print line number)
grep -i <keyword> <file> (n/N no sensitive)
grep -r <keyword> <file> (find include sub-folders)

environment variables

export <variable name>=<value> (set variable)
env (print all variables)
$<variable name> (use variable)
unset <variable name> (delete variable name)

Leave a comment