20 linux commands with their uses

  1. ls Command ls is probably the first command every Linux user typed in their terminal. It allows you to list the contents of the directory you want (the current directory by default), including files and other nested directories. ls It has many options, so it might be good to get some help by using the --help flag. This flag returns all the flags you can use with ls. For example, to colorize the output of the ls command, you can use the following: ls --color=auto The colorized ls command. Now the ls command output is colorized, and you can appreciate the difference between a directory and a file. But typing ls with the color flag would be inefficient; that’s why we use the alias command.
  2. alias Command The alias command lets you define temporary aliases in your shell session. When creating an alias, you instruct your shell to replace a word with a series of commands. For example, to set ls to have color without typing the --color flag every time, you would use: alias ls="ls --color=auto" As you can see, the alias command takes one key-value pair parameter: alias NAME="VALUE". Note that the value must be inside quotes. If you want to list all the aliases you have in your shell session, you can run the alias command without argument. alias The alias command.

  3. unalias Command As the name suggests, the unalias command aims to remove an alias from the already defined aliases. To remove the previous ls alias, you can use: unalias ls

  4. pwd Command The pwd command stands for “print working directory,” and it outputs the absolute path of the directory you’re in. For example, if your username is “john” and you’re in your Documents directory, its absolute path would be: /home/john/Documents. To use it, simply type pwd in the terminal: pwd

My result: /home/kinsta/Documents/linux-commands

  1. cd Command The cd command is highly popular, along with ls. It refers to “change directory” and, as its name suggests, switches you to the directory you’re trying to access. For instance, if you’re inside your Documents directory and you’re trying to access one of its subfolders called Videos, you can enter it by typing: cd Videos You can also supply the absolute path of the folder: cd /home/kinsta/Documents/Videos There are some tricks with the cd command that can save you a lot of time when playing around with it:
  2. Go to the home folder cd
  3. Move a level up cd ..
  4. Return to the previous directory cd -
  5. cp Command It’s so easy to copy files and folders directly in the Linux terminal that sometimes it can replace conventional file managers. To use the cp command, just type it along with the source and destination files: cp file_to_copy.txt new_file.txt You can also copy entire directories by using the recursive flag: cp -r dir_to_copy/ new_copy_dir/ Remember that in Linux, folders end with a forward slash (/).
  6. rm Command Now that you know how to copy files, it’ll be helpful to know how to remove them. You can use the rm command to remove files and directories. Be careful while using it, though, because it’s very difficult (yet not impossible) to recover files deleted this way. To delete a regular file, you’d type: rm file_to_copy.txt If you want to delete an empty directory, you can use the recursive (-r) flag: rm -r dir_to_remove/ On the other hand, to remove a directory with content inside of it, you need to use the force (-f) and recursive flags: rm -rf dir_with_content_to_remove/