VPS business hosting starting at $29.95/24/7 premium technical support

Linux commands for SSH

  1. tar– to create archive files(.zip, .tar)

Syntax:
tar [options] [archive-file] [file or directory to be archived]

Options:
-c : Creates Archive
-x : Extract the archive
-f : creates archive with given filename
-t : displays or lists files in archived file
-u : archives and adds to an existing archive file
-v : Displays Verbose Information
-A : Concatenates the archive files
-z : zip, tells tar command that create tar file using gzip
-j : filter archive tar file using tbzip
-W : Verify a archive file
-r : update or add file or directory in already existed .tar file

2. curl – Transfers data from or to a server, using one of the protocols: HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE.

Syntax:
curl [options] [URL…]

3. service– The service command is used to run a System V init script. Usually all system V init scripts are stored in /etc/init.d directory and service command can be used to start, stop, and restart the daemons and other services under Linux.

Syntax:
service SCRIPT-Name COMMAND
The COMMAND can be at least start, stop, status, and restart.

4. netstat– The netstat command is used to display very detailed information about how your computer is communicating with other computers or network devices.

5. wget– Wget is the non-interactive network downloader which is used to download files from the server even when the user has not logged on the system and it can work in background without hindering the current process.

Syntax:
wget [option] [URL]

6. grep– The grep filter searches a file for a particular pattern of characters, and displays all lines that contain that pattern.

Syntax:
grep [options] pattern [files]

Options Description
-c : This prints only a count of the lines that match a pattern
-h : Display the matched lines, but do not display the filenames.
-i : Ignores, case for matching
-l : Displays list of a filenames only.
-n : Display the matched lines and their line numbers.
-v : This prints out all the lines that do not matches the pattern
-e exp : Specifies expression with this option. Can use multiple times.
-f file : Takes patterns from file, one per line.
-E : Treats pattern as an extended regular expression (ERE)
-w : Match whole word
-o : Print only the matched parts of a matching line,
with each such part on a separate output line.

7. ls – list directory contents
Syntax:
ls [OPTION]… [FILE]…

ls -l list with long format, show permissions
ls -la list long format including hidden files

8. cat – Concatenate and print the content of files.

Syntax:
cat [Options] [File]…

9. nano– GNU nano is a text editor for Unix-like computing systems or operating environments using a command line interface.

10. vi – vi is a screen-oriented text editor originally created for the Unix operating system.

11. cp – cp stands for copy. This command is used to copy files or group of files or directory.

Syntax:
cp [OPTION] Source Destination
cp [OPTION] Source Directory
cp [OPTION] Source-1 Source-2 Source-3 Source-n Directory

First and second syntax is used to copy Source file to Destination file or Directory.
Third syntax is used to copy multiple Sources(files) to Directory.

12. mv– mv stands for move. mv is used to move one or more files or directories from one place to another in file system

Syntax:
mv [Option] source destination

13. sudo– sudo (“superuser do”, or “switch user do”) allows a user with proper permissions to execute a command as another user, such as the superuser.

14. rm -rm stands for remove here. rm command is used to remove objects such as files, directories, symbolic links and so on from the file system
Syntax:
rm [OPTION]… FILE…

15. mkdir– make directories
Syntax-
mkdir [OPTION]… DIRECTORY…

16. ln -The ln command is a standard Unix command utility used to create a hard link or a symbolic link (symlink) to an existing file. The use of a hard link allows multiple filenames to be associated with the same file since a hard link points to the inode of a given file, the data of which is stored on disk.
Syntax:
ln [OPTIONS] TARGET… LINK|DIRECTORY

Author: Harshvardhan Malpani

PHP Developer based in New Delhi, India. Working as a freelance web developer providing server deployment, website development and maintenance services.

Leave a Reply

Your email address will not be published. Required fields are marked *