Before moving on to the list of commands, you need to open the command line first. If you are using windows you can type cmd in search and open the command prompt, in Linux you can press ctrl+alt+t to open a terminal, and in mac In the Finder, open the /Applications/Utility folder, then double-click Terminal
Although the steps may differ depending on the distribution that you’re using, you can usually find the command line in the utility section.
Here are some basic Linux commands for beginners 🙌
1. cd command ➡️
cd command is used to navigate through the Linux files and directories. It requires either the full path or the name of the directory, depending on the current working directory that you’re in.
2.pwd command 📕
pwd command to find out the path of the current working directory (folder) you’re in.
3. mkdir command 📚
mkdir command is used to make a new directory.
4. ls command 📃
ls command is used to view the contents of a directory. By default, this command will display the contents of your current working directory.
There are variations you can use with the ls command:
- ls -R will list all the files in the sub-directories as well
- ls -a will show the hidden files
- ls -al will list the files and directories with detailed information like the permissions, size, owner, etc.
5. touch command ☝️📕
The touch command allows you to create a blank new file through the Linux command line.
6. cp command ©️
cp command to copy files from the current directory to a different directory.
7. mv command ➡️©️
The primary use of the mv command is to move files, although it can also be used to rename files.
8. rmdir command 📚❌
If you need to delete a directory, use the rmdir command. However, rmdir only allows you to delete empty directories.
9. rm command 📕❌
The rm command is used to delete directories and the contents within them. If you only want to delete the directory — as an alternative to rmdir — use rm -r(Be careful using this command).
10. cat command 😼😸
cat(short for concatenate) is used to list the contents of a file.
Some ways to use the cat command 😼 -
- cat > filename, to create a new file
- cat filename1 filename2>filename, joins two files (1 and 2) and stores the output of them in a new file (3)
This is all, for now, more commands to come in the next blog...stay tuned 🙌