Basic Linux Commands (Part-1)

Β·

3 min read

Basic Linux Commands (Part-1)

Table of contents

No heading

No headings in the article.

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.

Snap.png

2.pwd command πŸ“•

pwd command to find out the path of the current working directory (folder) you’re in.

Snap (1).png

3. mkdir command πŸ“š

mkdir command is used to make a new directory.

Snap (2).png

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.

Snap (2).png

5. touch command β˜οΈπŸ“•

The touch command allows you to create a blank new file through the Linux command line.

Snap (3).png

6. cp command ©️

cp command to copy files from the current directory to a different directory.

Snap (4).png

7. mv command ➑️©️

The primary use of the mv command is to move files, although it can also be used to rename files.

Snap (5).png

8. rmdir command πŸ“šβŒ

If you need to delete a directory, use the rmdir command. However, rmdir only allows you to delete empty directories.

Snap (6).png

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).

Snap (7).png

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)

Snap (8).png

This is all, for now, more commands to come in the next blog...stay tuned πŸ™Œ

Β