Basic Linux Commands (Part-1)

Pritam Panda's photo
Pritam Panda
ยทJul 25, 2022ยท

3 min read

Basic Linux Commands (Part-1)

Photo by Gabriel Heinzer on Unsplash

Subscribe to our newsletter and never miss any upcoming articles

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 ๐Ÿ™Œ

Did you find this article valuable?

Support Community Classroom by becoming a sponsor. Any amount is appreciated!

See recent sponsors |ย Learn more about Hashnode Sponsors
ย 
Share this