Common Commands :
file (filename) - Returns the type of file
less (filename) - Shows the file line by line instead of flooding everything
ln file1.txt file2.txt - Creates a hard link for the 2 files
ln -s file1.txt file2.txt - Creates a soft link for the 2 files
which (Exacutable Name) - Returns the location of the Executable (Only works for executable)
cat -n (file name) - Returns content of the file with number of lines printed
diff (file1) (file2) - Compares both the files and gives the difference
Creating own command :
To create a custom command which when ran executes your script.sh :
- Make it executable
- Move it to `~/.local/bin/(Command-Name)
- Check if
~/.local/binis in _PATH | grep ~/.local/bin`) - If not then add it in PATH (
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc) and thensource ~/.bashrc - Now simply type
(Command-Name)in CLI and the script is executed