Basic PuTTY Commands (SSH Commands)

0
Basic PuTTY Commands

Basic SSH (PuTTY) commands help you to navigate and work efficiently with the files in Linux terminal. In this guide, We’d handpicked a list of basic PuTTY commands, their options, and usage.

CommandsIt's Uses
PwdCheck the present location. Hit enters on type "pwd" command.
IsThis command used to display all the content in a folder or directory.
cdIt stands for change directory.
Type "cd /location"
It helps you to navigate.
cd .Helps you to stay at the same directory.
cd ..Command will shift one directory back.
cd -Commands take you back at the previous location.
For example, If you were at "/home" but you moved to "/dir".
Typing "cd-" command will take you back to "/home".
mkdirIt helps you to make the new directory.
Syntax: mkdir directoryNamecpThe command used to copy a file in Linux.
Syntax: cp filename.extension /dir/filename.extension.
The above command copies the file extension and keeps at the location/dir with the same name file.
cp –rCopy all the folder content.
cp -fIf a file with the same name happens in the destination, then it will force the copy process by deleting the destination file.
cp -iDisplay the warning message before proceeding with the copy process.
cp -uIf file have different content .It will update the file in the destination folder.
cp -nWill first check whether the file exists. If it happens. It don't overwrite the file again.
cp -aArchive the file.
mvThis command moves the file from one place to another.
(Syntax: mv filename.extension /dir/filename.extension)
The command"mv filename.extension /dir/filename1.extension” is used to move and
rename a file.
The command "mv filename/ ."Used to move file one folder back.
touchThis command creates a new file with any extension you want like text, HTML, PHP, etc. in your current directory.
Syntax: touch filename.
the extension helps to create a file extension without any extension.
rmRemove command will delete a file from a server.
Its Syntax: rm filename.extension.
"rm * folder name"Delete all the files or content in a directory.
"rmdir"Remove the complete directory or folder.
"rm -r folder name"Delete the folder as well as the folders inside it.
catTo display content of a file on the screen. It also copy standard input to standard output.
Syntax: cat filename.extension.
cat command also allows scrolling if the displayed text doesn't fit the screen completely.
cat command also used to create a new file.
Syntax: cat > filename.extension
It is also used to concatenate two files.
Syntax: catfile1.txtfile2.txt>mergedfile.txt
">" is the output redirection character
headAllow you to read the first ten lines of the content available inside the folder.
Syntax:head filename.extension
You can also update the number of lines you would like to display on the screen.
Syntax: head -n15 /temp/filename
Above Syntax will display the first fifteen lines of the content from the given file.
tailGives the last ten lines of content from the file.
Syntax: tail filename.extension
The tail command can provide multiple file names. It shows the last ten lines from each of the mentioned files.
Syntax: tail /dir/file1 /dir/file2
The tail command allows you to change the number of lines you want to be displayed, other than the default number.
Syntax: tail -n15 /temp/filename
Display the last fifteen lines of content from the given file.
zipCompress the file size.
The zip Syntax: zip -r foldername.zip folder name.
Delete the file from the zip archive by the following command
"zip -d filename.zip filename."
The following command can update the specified list of files.
"zip -u filename.zip filename."
To delete the original file after creating its zip archive.
By the following command,
"zip -m filename.zip filename."
unzipThis command is used to decompress a file.
Syntax: unzip filename.zip
Multiple numbers of data undone by using power.
"unzip file1.zip file2.zip file3.zip".
Syntax: unzip filename.zip -x excludedfile.zip
Syntax: unzip filename.zip -x excludedfile.zip
tarto compress and decompress folders, the tar command is used.
The command for compressing"folder".
tar -czvf folder1.tar.gz
The command for decompressing.
tar -xvf folder1.tar.gz
chmodIt allows you to change permissions of a file or directory. It stands for change mode.
Syntax: chmod 754 filenames.
Permissions can be represented either by numbers from 0 to 7 or with alphanumeric characters.
4 represents reading permission
2 represents writing permission
1 represents executing permission
0 represents no permission
5 is a combination of 4, 0, and 1. It suggests the read, no write, and execute an agreement.
4 are a combination of 4, 0, and 0. It indicates read, no write and no execute permission.
"chmod -r" allows you to change the permission of a folder and all the files inside it.
grepThis command enables you to search for a particular string inside a file or folder. If it finds the perfect match, it will return the whole line containing the phrase.
Syntax: grep "string" filenameThe command "grep -i "string" filename."Allow you to search for a string case-insensitively in the file.
The command "grep -c "string" filename." Allow you to count the number of appearances of a string in the given file.
The command "grep -l "string" *".-> display the filename that contains a particular pattern or string.
The command "grep -n "string" filename".-> display the line number along with the result.
findIt searches for a file inside a folder.
The Syntax: find. -name filename.extension.
By this Syntax, you can find files by permissions, users, groups, file type, size, etc.
The command "find /directory -name filename.extension"
find a file in some directory.
The power "find. type f -name filename.php".
You can look for any type of data, say a PHP file by using this command.
viIt allows you to enter a text editor.
Syntax: vi filename
The Syntax will open the data on the screen, and if the file doesn't exist, it will create a new one with the same name.
The escape key → allows you to cancel any command which has started in the vi editor mode.
To exit the vi editor, type ":q."
If in case you haven't done any changes to the file.
Type ":q!" to exit
If you want to undo the changes in a file.

Basic SSH (PuTTY) commands are beneficial for a user to manage the basic functionalities. These also commands helpful in handling the files and folders on a Linux web server.

LEAVE A REPLY

Please enter your comment!
Please enter your name here