CLI - Command Line Interface
CLI is an text based interface that allows users to interact with computer or device by writing commands, unlike a GUI (Graphical User Interface) which uses icons and buttons.
Advantages of CLI
Efficiency: After the initial learning curve, CLI is easy to use and is quicker as compared to GUI where switching between windows and icons consumes more time.
Learning Curve: Initially understanding and working with commands can be overwhelming but gradually it gives a better understanding of how computer system works.
Remote Access: CLI can work across networks, hence accessing files and folders becomes an easier task.
Version Control Integration: CLI can easily be integrated with your version control allowing you to manage your code from the command line.
Important CLI Commands
mkdir: Used to make a directory or folder.
mkdir Assignments
cd: This command is used to access or open a file or a folder.
cd Assignments ~/Assignments
touch: THis CLI command is used to create a blank file of any type like .txt, .py, etc.
touch hello.txt
rm: Used to remove or delete files or directories from a fie system. It has certain variations like:
rm hello.txt
rm -r: It removes the directory and all its content recursively.
rm -i: It is used when the user wants an interactive prompt to confirm before deleting the file or folder
rm -f: This command is used when the user want to delete a file or directory without being prompted to confirm the deletion process.
man: It is one of the most useful commands available as it allows us to see the manual page for various commands.
man rm
pwd: It stands for "print working directory" and is used to know the current directory the user is working on.
pwd ~/home/gaurav
ls: The ls command is used to list all the files and directories present in the current working directory. The ls command has some options to customize the output, namely:
ls
ls -a: It lists all the files along with hidden files and folders in the current directory.
ls -t: It is used to present the output list in a sorted format as per the modification time.
ls -l: It is used to display the files with their details.
ls -r: The out of this command is simply in the reverse order of the normal ls command.
apt: The apt command is a package management tool that allows us to install, update and remove various types of softwares on our system.
sudo apt install package_name
sudo: sudo stands for "superuser do". It is used to do administrative tasks that requires more user privileges than usual. This command allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.
sudo apt update
clear: It is a handy command that allows user to clear all the commands written on the terminal.
clear
vi / vim / nano : These are text editors with their own different features and user interfaces.
nano hello.txt
cat: This CLI command is used to concatinate and display the contents of one or more than one file.
cat
history: It is used to show the history of commands used on the CLI. Its default display limit may depend on the system configurations.
history
top: Used to see the system processes and the resources they are using along with other details like process ID(PID).
top
kill: It is used to stop or close a program or process being run via CLI.
kill 2567