Blog for Simple Commands in Linux Part 1

Linux incorporates a massive impact on our Lives. At least, your android phone has Linux system kernel on that. However, obtaining started with Linux system simply make you to discomfort for the first time. As a result of on Linux system, you always should use terminal commands rather than simply clicking the launcher icon. But don’t worry, we will provide you with ten basic Linux system commands which will assist you start.

Simple Command in Linux Part-1

1. chmod

In Linux operating systems, chmod is the command and system call which may change the access permissions to file system objects (files and directories).
Ex.

  • $ chmod +x sysinfo.sh

2. sudo

Sudo, the one command to rule all of them. It stands for “super user do!” Pronounced like “sue dough” As a Linux system administrator or computer user, it is one of the most important commands. Sudo prompts you for your personal password and confirms your request to execute a command by checking a file, called sudoers , which the system administrator configures.
Ex.

  • $ sudo apt update
  • $ sudo useradd tecmint
  • $ sudo passwd tecmint

3. cp

cp command is used for copying files and directories from one location to another.
cp has three principal modes of operation. These modes are inferred from the type and count of arguments presented to the program upon invocation.

  1. When the program has two arguments of path names to files, the program copies the contents of the first file to the second file, creating the second file if necessary.
  2. When the program has one or more arguments of path names of files and following those an argument of a path to a directory, then the program copies each source file to the destination directory, creating any files not already existing.
  3. When the program’s arguments are the path names to two directories, cp copies all files in the source directory to the destination directory, creating any files or directories needed. This mode of operation requires an additional option flag, typically r, to indicate the recursive copying of directories. If the destination directory already exists, the source is copied into the destination, while a new directory is created if the destination does not exist.

Copying a file to another file:

  • cp [-fHip][–] sourcefile targetfile

Copying file(s) to a directory

  • cp [-fHip] [–] sourcefile… targetdirectory

Copying a directory to a directory (-r or -R must be used)

  • cp -r|-R [-fHip] [–] sourcedirectory… targetdirectory

4. cd

The cd command – change directory – will allow the user to change between file directories in Linux. As the name command name suggest, you would use the cd command to circulate between two different directories.
If the user’s current working directory is the home directory (“~”), then entering the command ls followed by cd games might produce the following transcript:

Ex.

  • user@solace:~$ ls
  • user@solace:~$ cd games
  • user@solace:~/games$

5. whoami

  1. whoami command is used both in Linux OPERATING SYSTEM and as well as in WINDOWS OPERATING SYSTEM .
    It is basically the concatenation of the strings “who”,”am”,”i” as whoami.
  2. It displays the username of the current user when this command is invoked.
  3. It is similar as running the id command with the options -un.

Ex.

# whoami

root

6. mv

  1. mv stands for move. mv is used to move one or more files or directories from one place to another in file system like Linux. It has two distinct functions:
    It rename a file or folder.
  2. It moves group of files to different directory.

Ex.

$ mv new.txt test.txt

$ ls

test.txt

7. locate

While locate is no doubt one of the most popular as well as powerful command line utilities for file searching in Linux. The locate utility works better and faster than it’s find counterpart.
The command below will search for a file by its exact name (not *name*):
Ex.

$ locate -b ‘\domain-list.txt’

8. rm

rm stands for ‘remove’ because the name suggests rm command is used to delete or remove files and directory in Linux like operating system. But rm cannot simply delete a directory. Use “rm -r” to delete a directory. In this case, it deletes both the folder and the files in it.
Ex.

$ rm a.txt

9. touch

The touch command is a standard command used in Linux operating system which is used to create, change and modify timestamps of a file. It can be anything, from an empty txt file to an empty zip file. For example, “touch test.txt”.
Ex.

$ touch test.txt

10. clear

clear is a standard Linux computer operating system command that is used to clear the terminal screen. This command first looks for a terminal type in the environment and after that, it figures out the terminfo database for how to clear the screen.
Ex.

$ clear

Do you need to develop a web solution for your business on open source platform? Then you might need some help. Solace team is expert in Linux and is there to help you for development in linux. Contact us for any web development solution which lifts your business to the success it deserves.