If you’re new to Linux, chances are you’ll be using the SSH protocol to connect to remote servers. SSH (Secure Shell) is a network protocol that allows you to securely connect to a remote machine and execute commands on it.

In this blog post, we’ll go over some of the basic Linux SSH commands that you should know. We’ll cover everything from connecting to a server and executing commands, to transferring files and configuring your environment. By the end of this post, you should have a good understanding of how to use basic SSH in Linux.

“grep” Linux command

The grep command in Linux is a powerful tool that allows you to search for text patterns in files. It can be used to search for text in all files in a directory, or only in certain files. The grep command can also be used to search for text in a file and then print the line containing the text.

The grep command has many options that allow you to customize the way it searches for text. For example, the -i option tells grep to ignore case, so that it will find the text regardless of whether it is upper or lower case. The -n option tells grep to print the line number of each line that contains the text.

Grep can also be used with regular expressions to search for more complex patterns of text. Regular expressions are beyond the scope of this article, but there are many resources available online if you want to learn more about them.

If you just want to find out whether a file contains a certain piece of text, you can use the -q option, which tells grep not to print anything out; it will simply return an exit code of 0 if the text is found, or 1 if it is not found.

“vi” Linux command

The Linux “vi” command is a text editor that is used to create, edit, and view text files. The vi editor is the most popular text editor on Linux systems. Vi is a powerful text editor that has many features. Some of the most popular features of vi include:

– Syntax highlighting
– Line numbers
– Code completion
– A plugin system

Vi is a great choice for a text editor when working with Linux systems.

“kill” Linux command

The kill command is a simple way to terminate a process. The command takes the pid of the process to be killed as an argument.

# kill 987654321

The above command would kill the process with the pid 987654321.

“su” Linux command

The su command is used to switch users in Linux. It stands for “switch user” and allows you to change between different user accounts on the same machine. To use su, simply type “su” followed by the username of the account you want to switch to. For example, if you wanted to switch to the root account, you would type:

su root

You will then be prompted for that user’s password. Once entered, you will be logged in as that user. You can then run any commands you like as that user. To switch back to your previous user, simply type “exit” at the command prompt.

“pwd” Linux command

pwd is a Linux command that prints the current working directory. This is useful for when you need to know where you are in the file system.

“mkdir” Linux command

The “mkdir” command is used to create a directory in Linux. The syntax for this command is:

mkdir [options] directory_name

Some of the options that can be used with this command are:
-p: Used to create parent directories if they do not exist.
-v: Used to print a message for each created directory.

Examples:
1) To create a directory named “test”, we would use the following command:

mkdir test

2) To create a directory named “test” and all its parent directories, we would use the following command:
mkdir -p test

“rmdir” Linux command

The “rmdir” command is used to remove empty directories from the file system. This command will not remove directories that contain files or subdirectories. To remove a directory and all of its contents, use the “rm -r” command instead.

“ls” Linux command

The “ls” command is one of the most basic and commonly used Linux commands. It is used to list the contents of a directory. The ls command has many options that can be used to alter its output.

Some common ls options include:

-l : This option will list the contents of a directory in long format, which includes additional information such as file permissions, ownership, size, etc.

-a : This option will show all files in a directory, including hidden files. Hidden files are typically prepended with a . (dot) character.

-R : This option will recursively list the contents of all subdirectories within a directory.

-t : This option will sort the output of the ls command by modification time (most recently modified files first).

“chown” Linux command

The “chown” Linux command is used to change the ownership of a file or directory. The general syntax for this command is:

“chown [OPTIONS] USERNAME:GROUP DIRECTORY”.

The “-R” option can be used to recursively change the ownership of all files and subdirectories within a given directory. For example, to change the ownership of the “/home/user1” directory to user2, you would use the following command:

“chown -R user2: /home/user1”.

“wget” Linux command

Wget is a free software package for downloading files from the Web. It can be used to retrieve files using HTTP, HTTPS, and FTP protocols. Wget is a popular choice for automating downloads from the Internet.

The wget command can be used to download files from the Web directly from the command line. The syntax for the wget command is:

wget [option] [URL]

The options available for the wget command are:

-V – Prints the version number of Wget;
-h – Prints a help message describing all of the available options;
-b – Background mode. Wget will run in the background until it is finished downloading the specified files;
-c – Continue downloading a partially downloaded file. This is useful if your connection is interrupted while downloading a file;
-i – input_file – Download multiple files listed in input_file, with one URL per line;
-o – output_file – Write the output of Wget to output_file instead of to standard output;
-O – Download only newer versions of files that already exist locally;
-P prefix – Sets the prefix where downloaded files will be saved to on your local machine;
-q – Quiet mode. Wget will not print progress information to standard output;
-r – Recursive mode. Wget will follow links and download all files in the specified directory and its subdirectories

If you feel these commands were not enough, you might want to check out the Linux commands to check disk space.