How to use SSH to connect to a remote server in Linux | ssh Command
Last Updated :
12 Jul, 2024
Secure Shell, commonly known as SSH, is like a super-secure way to talk to faraway computers, called servers. It's like a secret tunnel on the internet that keeps your conversations safe and private. Imagine you're sending a letter, and instead of sending it openly, you put it in a magic envelope that only you and the person you're sending it to can open. That's what SSH does for your computer talks.
This article is here to help beginners, those who are just starting with this stuff, to understand how to use SSH. We'll show you the steps to use a special command (think of it like a secret handshake) to connect your computer to a faraway server in the world of Linux. By the end of this guide, you'll be more confident in using SSH to make your computer talks safe and secure when dealing with those remote servers.
What is SSH ?
SSH, or Secure Shell, constitutes a cryptographic network protocol designed to enable secure communication between two systems over networks that may not be secure. This protocol is widely employed for remote access to servers and the secure transmission of files between computers. In essence, SSH acts as a secure conduit, establishing a confidential channel for communication in scenarios where the network may pose security risks. This technology is instrumental for professionals seeking a reliable and secure method of managing servers and transferring sensitive data across computers in a controlled and protected manner. ssh runs at TCP/IP port 22.
Syntax of SSH Command in Linux
The basic syntax for using the SSH command is as follows:
ssh [username]@[hostname or IP address]
Here,
Replace [
username
]
with your remote server username, and [
hostname or IP address
]
with the server's hostname or IP address.
Prerequisites
Before delving into the world of SSH, it's essential to ensure that certain prerequisites are in place. Here's a checklist to guarantee a smooth connection:
- Remote Computer Status:
- Make sure the remote computer is turned on and has an active network connection. SSH relies on network connectivity, and the remote server needs to be accessible.
- Identification Information:
- Obtain the IP address or the name of the remote machine. This information is crucial for directing your SSH connection to the correct server.
- Permission to Access:
- Ensure that you have the necessary permissions to access the remote computer. This typically involves having a valid username and password for the remote server.
- Firewall Settings:
- Check the firewall settings on both your local machine and the remote server. SSH connections use a specific port (usually port 22), so it's crucial to ensure that your firewall allows SSH traffic. Adjustments may be required to permit secure communication.
Install SSH Component on Linux
Setting up SSH on Linux may be necessary, as some distributions don't come with it pre-installed. Installing OpenSSH, a widely used SSH implementation, or opting for a graphical user interface (GUI) solution like the PuTTY client for Ubuntu can address this. Here's a step-by-step guide on installing and configuring OpenSSH on both the client and server sides:
Installing it on Both Client and Server
For Debian/Ubuntu-based Systems, open the terminal and run:
sudo apt install openssh-client openssh-server
For Red Hat-based systems like CentOS or Fedora, use either of the following commands:
sudo dnf install openssh-clients openssh-server
or
sudo yum install openssh-clients openssh-server
Note : To check the status of running server after installation we can use this command "systemctl status sshd"
In case the service is not running, run it with the following command:
sudo systemctl start sshd
The command does not print an output.
To have the service start automatically on boot, run:
sudo systemctl enable sshd
Enabling the sshd service starts it during the boot process.
How to Use SSH to Connect to a Remote Server in Linux
In this example we access Ubuntu or Red hat Linux machine via the Windows command prompt using `ssh`
For example: If our IP address is "10.143.90.2" and username is "Jayesh"
Syntax to use ssh to connect to a remote server:
ssh [email protected]
Add your username in place of "Jayesh" and add your IP address in place of "10.143.90.2"
ssh to linux system from windowscommand consists of 3 different parts:
- ssh command instructs the system to establish an encrypted secure connection with the host machine.
- user_name represents the account that is being accessed on the host.
- host refers to the machine which can be a computer or a router that is being accessed. It can be an IP address (e.g., 192.168.1.24) or domain e.g., www.domainname.com).
Note: After logging into the host computer, commands will work as if they were written directly to the host terminal. Using a public-private key pair or SSH key pair to login into the remote host is more secure as compared to using passwords.
How to create public-private keys?
For generating public-private keys use the command:
ssh-keygen
ssh-keygenThe private key must remain hidden while the public key must be copied to the remote host. After copying the public key to the remote host, the connection will be established using SSH keys and not the password.
Options available in ssh
Note: Here instead of user and host add username and IP address you want to connect to. And localhost is IP of our local system.
Options | Description | Syntax |
---|
-1 | Forces ssh to use protocol SSH-1 only. | ssh -1 user@host
|
---|
-2 | Forces ssh to use protocol SSH-2 only. | ssh -2 user@host
|
---|
-4 | Allows IPv4 addresses only. | ssh -4 user@host
|
---|
-6 | Allows IPv6 addresses only. | ssh -6 user@host
|
---|
-A | Authentication agent connection forwarding is enabled. | ssh -A user@host
|
---|
-a | Authentication agent connection forwarding is disabled. | ssh -a user@host
|
---|
-C | Compresses all data (including stdin, stdout, stderr, and data for forwarded X11 and TCP connections) for a faster transfer of data. | ssh -C user@host
|
---|
-c | Selects the cipher specification for encrypting the session. Specific cipher algorithm will be selected only if both the client and the server support it. | ssh -c aes256-cbc user@host
|
---|
-f | Requests ssh to go to background just before command execution. | ssh -f user@host command
|
---|
-g | Allows remote hosts to connect to local forwarded ports. | ssh -g -L 8080:localhost:80 user@host
|
---|
-n | Prevents reading from stdin. | ssh -n user@host command
|
---|
-p | Port to connect to on the remote host. | ssh -p 2222 user@host
|
---|
-q | Suppresses all errors and warnings | ssh -q user@host
|
---|
-V | Display the version number. | ssh -V
|
---|
-v | Verbose mode. It echoes everything it is doing while establishing a connection. It is very useful in the debugging of connection failures. | ssh -v user@host
|
---|
-X | Enables X11 forwarding (GUI Forwarding). | ssh -X user@host
|
---|
The Three Major Encryption Techniques Used by SSH.
SSH is significantly more secure than the other protocols such as telnet because of the encryption of the data. There are three major encryption techniques used by SSH:
- Symmetrical encryption: This encryption works on the principle of the generation of a single key for encrypting as well as decrypting the data. The secret key generated is distributed among the clients and the hosts for a secure connection. Symmetrical encryption is the most basic encryption and performs best when data is encrypted and decrypted on a single machine.
- Asymmetrical encryption: This encryption is more secure because it generates two different keys: Public and Private key. A public key is distributed to different host machines while the private key is kept securely on the client machine. A secure connection is established using this public-private key pair.
- Hashing: One-way hashing is an authentication technique which ensures that the received data is unaltered and comes from a genuine sender. A hash function is used to generate a hash code from the data. It is impossible to regenerate the data from the hash value. The hash value is calculated at the sender as well as the receiver's end. If the hash values match, the data is authentic.
Conclusion
In this article we discussed Secure Shell (SSH) which is like a secret, safe tunnel for computers to talk securely over the internet. This guide is for beginners, helping them use SSH to connect their computer to faraway servers in the Linux world. It covers everything from the basic SSH command to prerequisites like checking your internet connection and having the right permissions. You'll learn how to install SSH on Linux, create secure keys, and use them for safer logins. The article also includes frequently asked questions with simple answers, making sure you can confidently and securely manage remote servers using SSH in Linux. It's like giving your computer a secret code to talk safely on the internet!
Similar Reads
Linux Commands Linux commands are essential for controlling and managing the system through the terminal. This terminal is similar to the command prompt in Windows. Itâs important to note that Linux/Unix commands are case-sensitive. These commands are used for tasks like file handling, process management, user adm
15+ min read
File and Directory Manipulation
ls Command in LinuxThe ls command is one of the most used commands in the Linux terminal to display the files and directories or path in the terminal. So, using the ls command is a basic skill for navigating the Linux file system, handling files, and managing directories.What is the ls Command in LinuxThe ls command i
10 min read
How to Change the Directory in Linux | cd CommandNavigating the Linux file system is like exploring a vast library; each directory (folder) holds its own collection of files and subdirectories, and knowing how to move between them efficiently is the first step to mastering the command line. The cd (Change Directory) command is your compass in this
7 min read
How to Display Current Working Directory in Linux | pwd CommandThe 'pwd,' which stands for "print working directory." In this article, we will delve into the 'pwd' command, exploring its functionality, usage, and various examples. It prints the path of the working directory, starting from the root. pwd is shell built-in command(pwd) or an actual binary(/bin/pwd
4 min read
How to Create Directory in Linux | mkdir CommandIn Linux, the 'mkdir' command is like a magic wand for creating folders super easily. 'mkdir' stands for "make directory," and it helps you organize your computer stuff by creating folders with just one command. Whether you're making one folder or a bunch of them in a row, 'mkdir' is there to help y
7 min read
rm command in Linux with examplesrm stands for remove here. rm command is used to remove objects such as files, directories, symbolic links and so on from the file system like UNIX. To be more precise, rm removes references to objects from the filesystem, where those objects might have had multiple references (for example, a file w
5 min read
How to Copy Files and Directories in Linux | cp CommandThe cp (copy) command is your go-to tool in Linux for duplicating files and folders quickly. Whether youâre backing up data, organizing files, or sharing content, cp lets you copy items between locations while keeping the original intact. The cp command requires at least two filenames in its argumen
8 min read
How to Move File in Linux | mv CommandIn UNIX-based operating systems like Linux and macOS, `mv` stands for "move". The mv command is a UNIX command for renaming and moving files and directories within a filesystem. Although desktop operating systems have graphical user interfaces for file operations, calling mv in the terminal, usually
7 min read
How to Create an Empty File in Linux | Touch CommandThe touch command is a standard command used in the UNIX/Linux operating system which is used to create, change and modify the timestamps of a file. Basically, there are two different commands to create a file in the Linux system which are as follows: touch command: It is used to create a file witho
7 min read
How to View the Content of File in Linux | cat CommandThe cat command in Linux is more than just a simple tool, it's a versatile companion for various file-related operations, allowing users to view, concatenate, create, copy, merge, and manipulate file contents. Let's see the details of some frequently used cat commands, understanding each example alo
7 min read
grep command in Unix/LinuxThe grep command in Unix/Linux is a powerful tool used for searching and manipulating text patterns within files. Its name is derived from the ed (editor) command g/re/p (globally search for a regular expression and print matching lines), which reflects its core functionality. grep is widely used by
7 min read
File Operations and Compression
How to Find a File in Linux | Find CommandThe find command in Linux is used to search for files and directories based on name, type, size, date, or other conditions. It scans the specified directory and its sub directories to locate files matching the given criteria.find command uses are:Search based on modification time (e.g., files edited
9 min read
How to Compress Files in Linux | Tar CommandFile compression is a fundamental task in managing and transferring data efficiently on a Linux system. The Tar command, short for Tape Archive, is a powerful tool that allows users to create compressed and archived files. In this comprehensive guide, we will explore the various options and examples
11 min read
Gzip Command in LinuxThe gzip command in Linux is a vital tool for compressing files and reducing their sizes. It employs the DEFLATE compression algorithm , which makes it highly effective for compressing large files or preparing data for transfer over networks.Whether youâre a Linux system administrator or a beginner,
5 min read
gunzip Command in Linux with ExamplesThe gunzip command in Linux is a popular tool for decompressing files compressed with gzip. It simplifies file unzipping, enhances file management, and optimizes disk space in Linux environments.In this blog post, we will explore how gunzip works, providing practical examples for you to try. Whether
5 min read
ZIP command in Linux with examplesIn Linux, the zip command compresses one or more files or directories into a single.zip archive file. This saves disk space, keeps data organized, and makes it simple to share or backup files. It's among the most used compression utilities, particularly when sharing large files via email or storing
6 min read
How to Install Zip and Unzip in Linux?Zip is a command-line compression utility for files and directories. File and folder compression allows for quicker and more reliable file and folder transfer, storage, and email. Unzip, on the other hand, is a program that allows you to decompress files and directories. zip is used to compress the
2 min read
How to Make Script Executable in Linux | chmod CommandIn Unix operating systems, the chmod command is used to change the access mode of a file. The name is an abbreviation of change mode. Which states that every file and directory has a set of permissions that control the permissions like who can read, write or execute the file. In this the permissions
7 min read
How to Change File Ownership in Linux | chown CommandIn the Linux operating system, file ownership is a crucial aspect of system security and user management. The chown command, short for "change owner," is a powerful tool that allows users to change owner of file in Linux. This command is particularly useful in scenarios where administrators need to
9 min read
chgrp command in Linux with ExamplesThe `chgrp` command in Linux is used to change the group ownership of a file or directory. All files in Linux belong to an owner and a group. You can set the owner by using âchownâ command, and the group by the "chgrp" command. Syntax of `chgrp` command in Linuxchgrp [OPTION]⦠GROUP FILE⦠chgrp [OPT
3 min read
How to List Running Processes in Linux | ps CommandAs we all know Linux is a multitasking and multi-user system. So, it allows multiple processes to operate simultaneously without interfering with each other. Process is one of the important fundamental concepts of the Linux OS. A process is an executing instance of a program that carries out differe
10 min read
Network and Connectivity
How to Monitor System Activity in Linux | top Commandtop command is used to show the Linux processes. It provides a dynamic real-time view of the running system. Usually, this command shows the summary information of the system and the list of processes or threads which are currently managed by the Linux Kernel. As soon as you will run this command it
10 min read
How to Kill a Process in Linux | Kill Commandkill command in Linux (located in /bin/kill), is a built-in command which is used to terminate processes manually. kill command sends a signal to a process that terminates the process. If the user doesn't specify any signal that is to be sent along with the kill command, then a default TERM signal i
6 min read
ifconfig CommandKnowing your IP address is fundamental for network administration, troubleshooting, and various Linux system tasks. In this article, we will explore several methods to find your IP address in a Linux environment. Whether you are a seasoned Linux user or just getting started, understanding these meth
10 min read
How to Check Network Connectivity in Linux | ping CommandEnsuring a stable and reliable internet connection is crucial for seamless navigation and efficient communication in the world of Linux. The "ping" command is a powerful tool that allows users to check the status of their internet connection and diagnose network-related issues. In this article, we w
7 min read
How to use SSH to connect to a remote server in Linux | ssh CommandSecure Shell, commonly known as SSH, is like a super-secure way to talk to faraway computers, called servers. It's like a secret tunnel on the internet that keeps your conversations safe and private. Imagine you're sending a letter, and instead of sending it openly, you put it in a magic envelope th
8 min read
How to Securely Copy Files in Linux | scp CommandSecure file transfer is a crucial part of Linux systems administration. Whether moving sensitive files between local machines or transferring data between servers, or you need to move backup files to a remote server, fetch logs from a hosted machine, or sync directories across multiple systems, scp
10 min read
Wget Command in Linux/UnixWget is the non-interactive network downloader which is used to download files from the server even when the user has not logged on to the system and it can work in the background without hindering the current process. GNU wget is a free utility for non-interactive download of files from the Web. It
6 min read
curl Command in Linux with Examplescurl is a command-line utility for transferring data to or from a server, employing a range of internet protocols such as HTTP, HTTPS, FTP, SCP, and SFTP.Whether you want to download a file, test a REST API, or simply verify that a website is up and running, curl is your best friend. It is accessed
5 min read
How to Compare Files Line by Line in Linux | diff CommandIn the world of Linux, managing and comparing files is a common task for system administrators and developers alike. The ability to compare files line by line is crucial for identifying differences, debugging code, and ensuring the integrity of data. One powerful tool that facilitates this process i
9 min read
Head Command in Linux With ExamplesNeed to quickly view the beginning of a file in Linux? The head command is your best option. This essential command-line tool enables users, developers, and system administrators to preview the start of log files, configuration files, CSV datasets, and other text documents in seconds.The head comman
6 min read
Text Processing and Manipulation
Tail command in Linux with examplesIt is the complementary of head command. The tail command, as the name implies, prints the last N number of data of the given input. By default, it prints the last 10 lines of the specified files. If more than one file name is provided then data from each file is preceded by its file name. Syntax of
7 min read
How to sort lines in text files in Linux | sort CommandThe sort command in Linux is used to sort a file, arranging the records in a particular order. By default, the sort command sorts file assuming the contents are ASCII. Using options in the sort command can also be used to sort numerically.sort is a command that sorts text files alphabetically, numer
7 min read
AWK command in Unix/Linux with examplesAwk is a scripting language used for manipulating data and generating reports. The awk command programming language requires no compiling and allows the user to use variables, numeric functions, string functions, and logical operators. Awk is a utility that enables a programmer to write tiny but eff
8 min read
Sed Command in Linux/Unix With ExamplesThe SED command (short for Stream Editor) is one of the most powerful tools for text processing in Linux and Unix systems. It's commonly used for tasks like search and replace, text transformation, and stream editing.With SED, you can manipulate text files without opening them in an editor. This mak
8 min read
cut command in Linux with examplesThe cut command in linux is a command for cutting out the sections from each line of files and writing the result to standard output. It can be used to cut parts of a line by byte position, character, and field. The cut command slices a line and extracts the text. It is necessary to specify an optio
8 min read
tr command in Unix/Linux with examplesThe tr command is a UNIX command-line utility for translating or deleting characters. It supports a range of transformations including uppercase to lowercase, squeezing repeating characters, deleting specific characters, and basic find and replace. It can be used with UNIX pipes to support more comp
4 min read
echo command in Linux with ExamplesThe echo command in Linux is a built-in command that allows users to display lines of text or strings that are passed as arguments. It is commonly used in shell scripts and batch files to output status text to the screen or a file. Syntax of `echo` command in Linuxecho [option] [string]Here, [option
3 min read
export command in Linux with ExamplesThe 'export' command is one of the essential built-in commands in the Bash shell, allowing users to manage environment variables effectively. It is defined in POSIX standards, which state that the shell will assign the export attribute to specified variables, causing them to be included in the envir
2 min read
source Command in Linux with ExamplesIf you're new to the world of Linux, you might have heard about commands that do various tasks, but some like the 'source' command might seem a bit confusing at first. Don't worry; let's break it down step by step.What is the Source Command?The source command in Linux is like a magic wand that lets
7 min read
How to Display Command History in Linux | history CommandThe history command in Linux is essential for terminal users, enabling them to view, search, and manipulate previously executed commands. Now, mastering this Linux command allows for efficient commands of commands, automation of repetitive tasks, and troubleshooting without the need to retype length
3 min read
Help and Information
apropos command in Linux with ExamplesLinux/Unix comes with a huge number of commands and thus it become quite difficult sometimes to remember each and every command. apropos command becomes useful in such cases. apropos command helps the user when they don't remember the exact command but knows a few keywords related to the command tha
3 min read
info command in Linux with Examplesinfo command reads documentation in the info format. It will give detailed information for a command when compared with the man page. The pages are made using the Texinfo tools which can link with other pages, create menus, and easy navigation. Here, we will explore the functionality of the info com
3 min read
How to Create and Use Alias Command in LinuxImagine you're lost in a maze of complicated Linux commands. You stumble upon a secret doorway marked "Alias," and inside you find shortcuts to all your favorite commands! That's what creating aliases is like. You get to make your own mini-commands for the long ones you use all the time, making thin
6 min read
uname command in Linux with ExamplesLinux, renowned for its open-source flexibility and powerful performance, offers a range of commands that reveal the inner workings of your system. Among these, the 'uname' command stands out as a versatile tool that provides key details about your Linux machine. Here, we will learn the basics of th
4 min read
df command in Linux with ExamplesEver felt the chilling fear of a "disk full" error message on your Linux machine? Fear not, for the mighty df command stands ready to guide you through the treacherous terrain of disk space management! This article delves deep into the df command, equipping you with the knowledge and skills to navig
5 min read
du command in Linux with examplesThe `du` command in Linux is a powerful utility that allows users to analyze and report on disk usage within directories and files. Whether you're trying to identify space-hogging directories, manage disk space efficiently, or simply gain insights into storage consumption, the du command provides va
6 min read
How to Mount File System in Linux | mount CommandWorking with file systems is a fundamental part of managing a Linux system, and knowing how to mount them is a skill every Linux user should have. Whether youâre connecting a USB drive, accessing a network share, or setting up a new partition, the mount command is your go-to tool for making file sys
6 min read
ln command in Linux with ExamplesThe 'ln' command in Linux is a powerful utility that allows you to create links between files. These links can either be hard links or soft (symbolic) links. If you're unfamiliar with these concepts, check out our detailed guide on Hard and Soft Links in Linux to understand their differences, use ca
3 min read
System Administration and Control
How to Display Path of an Executable File in Linux | Which CommandIn Linux finding the exact path of an excutable file can be crucial for the system adminstration, scripting and as well for troubleshooting. The `which` command helps with providing a simple and effective way to locate the executable files within the directories that are listed in your system. In th
6 min read
whereis command in Linux with Examples'whereis' command is used to find the location of source/binary file of a command and manuals sections for a specified file in Linux system. If we compare 'whereis' command with 'find' command they will appear similar to each other as both can be used for the same purposes but 'whereis' command prod
4 min read
locate command in Linux with Exampleslocate command in Linux is used to find the files by name. There are two most widely used file-searching utilities accessible to users called to find and locate. The locate utility works better and faster than the find command counterpart because instead of searching the file system when a file sear
6 min read
How to Display and Set Date and Time in Linux | date CommandUnlock the full potential of the date command in Linuxâa versatile tool that does more than just show the current date and time. With this command, you can set your systemâs clock, synchronize time across networks, and even calculate past or future dates for tasks like scheduling or logging. In this
8 min read
cal command in Linux with ExamplesThe 'cal' command in Linux is a versatile tool that displays calendars directly in the terminal. If a user wants a quick view of the calendar in the Linux terminal, 'cal' is the command for you. Hereâs a look at the usage and features of 'cal' command in Linux.What is the 'cal' command?cal command i
2 min read
How to Start, Stop and Restart Services in Linux Using systemctl CommandSystem services play a crucial role in the functioning of a Linux system, handling various tasks and processes in the background. systemctl is a powerful command-line tool that allows users to manage these services effectively. In this article, we will explore the basics of using systemctl to start,
9 min read
shutdown command in Linux with ExamplesThe `shutdown` operation in Linux is a crucial command for managing system power states, allowing administrators to halt safely, power off, or reboot the system. This command provides flexibility in scheduling downtimes, ensuring minimal disruption to users and processes. In this article, we will ex
5 min read
User and Group Management
init command in Linux with examplesThe init process is the parent of all processes in Linux, identified by the process ID (PID) of 1. It is the first process that starts when a computer boots up and continues to run until the system shuts down. The term init stands for "initialization," and its primary role is to create and manage pr
4 min read
How to add User in Linux | useradd Commanduseradd is a command in Linux that is used to add user accounts to your system. It is just a symbolic link to adduser command in Linux and the difference between both of them is that useradd is a native binary compiled with the system whereas adduser is a Perl script that uses useradd binary in the
5 min read
usermod command in Linux with Examplesusermod command or modify user is a command in Linux that is used to change the properties of a user in Linux through the command line. After creating a user we have to sometimes change their attributes like password or login directory etc. so in order to do that we use the Usermod command. The info
4 min read
How to Delete User in Linux | userdel CommandManaging user accounts is an essential aspect of Linux system administration. Understanding how to delete a user in Linux is crucial, whether you need to remove an unused account, revoke access for a departing employee, or clean up your system for security reasons. Here, we will explore the 'userdel
5 min read
How to Create a new group in Linux | groupadd commandIn the Linux operating system, user management is a crucial aspect of system administration. One of the fundamental tasks is creating and managing user groups. Groups in Linux allow administrators to organize and control user access to various resources and files. The groupadd command is a powerful
7 min read
groupmod command in Linux with examplesgroupmod command in Linux is used to modify or change the existing group on Linux system. It can be handled by superuser or root user. Basically, it modifies a group definition on the system by modifying the right entry in the database of the group. Syntax: groupmod [option] GROUP Files: The groupmo
2 min read
How to Delete a Group in Linux | groupdel commandGroup management is a crucial aspect of Linux system administration, and understanding how to create, modify, and delete groups is essential for maintaining a secure and organized environment. In this article, we will delve into the process of deleting a group in Linux using the 'groupdel' command.
3 min read
How to Change User Password in Linux | passwd CommandSecuring user accounts is a fundamental aspect of maintaining a robust and secure Linux system. One essential task is changing user passwords regularly to prevent unauthorized access. The passwdpasswd command in Linux provides a straightforward and effective way to modify user passwords. This articl
8 min read
Difference Between su and su - Command in LinuxAs a new Linux user, you may always face confusion regarding the difference between `su` command and `su -` command. In Linux, the `su` command is used to switch to another user account. However, there are two variations of the `su` command: `su` and `su -` (su hyphen).Table of ContentWhat is Linux
6 min read
Privilege and Security Management
chroot command in Linux with examplesThe 'chroot' command in Linux and Unix-like systems is used to change the root directory for the current running process and its child processes. This change creates a restricted environment, often referred to as a "chroot jail" or "jailed directory," where processes are limited to accessing only fi
3 min read
file command in Linux with examplesThe 'file' command in Linux is a vital utility for determining the type of a file. It identifies file types by examining their content rather than their file extensions, making it an indispensable tool for users who work with various file formats. The file type can be displayed in a human-readable f
3 min read
hexdump command in Linux with examplesThe 'hexdump' command in Linux is a versatile utility used to display file content or data from standard input in a human-readable format. It is invaluable for programmers and system administrators for debugging binary data, analyzing file structures, and verifying data integrity. Here we will get a
5 min read
wc command in Linux with exampleswc stands for word count. As the name implies, it is mainly used for counting purpose.It is used to find out number of lines, word count, byte and characters count in the files specified in the file arguments.By default it displays four-columnar output.First column shows number of lines present in a
6 min read
tee command in Linux with examplestee command reads the standard input and writes it to both the standard output and one or more files. The command is named after the T-splitter used in plumbing. It basically breaks the output of a program so that it can be both displayed and saved in a file. It does both the tasks simultaneously, c
2 min read
script command in Linux with ExamplesThe 'script' command in Linux is a versatile tool that allows you to record all terminal activities, including inputs and outputs, making it a valuable resource for developers, system administrators, educators, and anyone who needs to document terminal sessions. This command captures everything disp
5 min read
How To Generate SSH Key With ssh-keygen In Linux?Secure Shell(SSH) is a cryptographic network protocol used for operating remote services securely. It is used for remote operation of devices on secure channels using a client-server architecture that generally operates on Port 22. SSH is the successor of Telnet. SSH uses public and private keys to
4 min read
Process Management and Control
'crontab' in Linux with ExamplesIf you do manually backups , update logs, or restart services on your Linux machine? Imagine that running repetitive tasks overnight so your machine works for you while you rest. Here crontab, the native job scheduler in Linux, which enables users to easily automate commands, scripts, and system tas
9 min read
at Command in Linux with ExamplesIn the world of Linux operating systems, there exists a powerful tool known as the "at command." The 'at' command provides users with the ability to schedule tasks to be executed at a later time, offering a convenient way to automate processes without manual intervention. Whether you need to run a s
9 min read
nohup Command in Linux with ExamplesEvery command in Linux starts a process at the time of its execution, which automatically gets terminated upon exiting the terminal. Suppose, you are executing programs over SSH and if the connection drops, the session will be terminated, all the executed processes will stop, and you may face a huge
5 min read
bg command in Linux with ExamplesIn Linux, the bg command is a useful tool that allows you to manage and move processes between the foreground and background. It's especially helpful when you want to multitask in the terminal by placing a process in the background, enabling you to continue using the terminal for other commands whil
3 min read
fg command in Linux with examplesThe fg command in Linux is used to bring a background job into the foreground. It allows you to resume a suspended job or a background process directly in the terminal window, so you can interact with it.Syntaxfg [job_spec]The job_spec is a way to refer to the background jobs that are currently runn
3 min read
Process Control Commands in Unix/LinuxProcess control commands in Unix are: bg - put suspended process into background fg - bring process into foreground jobs - list processes bg Command : bg is a process control command that resumes suspended process while keeping them running in the background. User can run a job in the background by
3 min read
Shell Script to Demonstrate Wait Command in LinuxWait command is one of the process management commands. There are different process commands in Linux mainly 5 commands are widely used which are ps, wait, sleep, kill, exit. ps is an acronym for process status. It displays information about the active processes. wait command will suspend execution
4 min read