As a front-end web developer, these 12 basic commands must be

As a front-end web developer, these 12 basic commands must be

For developers, the terminal is one of the most important tools. Mastering the terminal can effectively improve the workflow of developers. Using the terminal, many daily tasks have been simplified to write simple commands and press the Enter button.


This article lists a series of Linux commands to help you make the most of the terminal tool. Some of the terminal commands are built-in, others are free tools, and after testing these tools can be installed in less than a minute.



Curl is a command line tool for making requests via HTTP(s), FTP, and dozens of other protocols. Use Curl to download files, check response headers, and freely access remote data.

In web development, Curl is often used with RESTful APIs to test connections.

# Fetch the headers of a URL.
curl -I
HTTP/1.1 302 Found
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Referrer-Policy: no-referrer
Content-Length: 258
Date: Wed, 09 Aug 2017 11:24:01 GMT

# Make a GET request to a remote API.
29 is the number of days it takes Saturn to orbit the Sun. 

The Curl command may be more complicated than the above code. There are many options for controlling headers, cookies, authentication, etc. To learn more, please read Everything curl .



Tree is a small command-line utility that displays the files in the directory in a visual way. It uses recursive operation, traversing each level of nesting and drawing the format tree of all content. In this way, you can quickly browse and find the files you need.


You can also use a simple regEx mode to filter the results:

tree -P '*.min.*'


According to the wiki's explanation, Tmux is a terminal multiplexer. In layman's terms, it is a tool that can connect multiple terminals to a single terminal session.

Tmux allows users to switch between programs in the terminal, add screen panes, and connect multiple terminals to the same session to keep them synchronized. When working on a remote server, Tmux is particularly useful because it allows users to create new tabs without having to log in again.



The du command is used to generate reports on the space usage of files and directories. du is easy to use and can be run recursively, traversing each subdirectory and returning the size of each file.

A common use case for du is: when a drive has insufficient space, the user does not know the size of each storage. Use this command to quickly view the storage space occupied by each folder to find the storage that takes up the most space.

# Running this will show the space usage of each folder in the current directory.
# The -h option makes the report easier to read.
# -s prevents recursiveness and shows the total size of a folder.
# The star wildcard (*) will run du on each file/folder in current directory.
du -sh *
1.2G    Desktop
4.0K    Documents
40G     Downloads
4.0K    Music
4.9M    Pictures
844K    Public
4.0K    Templates
6.9M    Videos 

There is also a similar command  df (Disk Free), using df will return various information about the available disk space.



Git is by far the most popular version control system and one of the defining tools for modern web development.

Git has many third-party applications and tools that can be used, but most people like to access git through a local terminal. The git CLI is very powerful and can handle the most confusing project version issues.

To learn more about git, I recommend learning "  Learn Git in 30 Minutes ".



Tar is the default Unix tool for file archiving. Tar allows users to quickly bind multiple files into one package, making it easier to store and move.

tar -cf archive.tar file1 file2 file3 

The -x option can also be used to extract existing .tar archives.
tar -xf archive.tar 

Please note that most other formats such as .zip and .rar cannot be opened with the tar command. To open files such as .zip and .rar,  a command such as unzip is required  .

Many modern Unix systems are running an extended version of tar (GNU tar), which can help compress the size of the executable file:

# Create compressed gzip archive.
tar -czf file.tar.gz inputfile1 inputfile2
# Extract .gz archive.
tar -xzf file.tar.gz 

If your operating system does not have this version of tar, you can use  gzip , zcat  or  compress  to compress the size of the archive file.



Unix has several built-in hash commands, including  md5sum , sha1sum,  etc. These command-line tools have many applications in programming, but the most important function is that they can be used to check the integrity of files.

For example, if you download an .iso file from an untrusted source, the file may contain harmful scripts. To ensure that the .iso is safe, users can generate md5 or other hashes from it.

md5sum ubuntu-16.04.3-desktop-amd64.iso 
0d9fe8e1ea408a5895cbbe3431989295  ubuntu-16.04.3-desktop-amd64.iso 

Then, you can compare the generated string with the string provided by the original author (such as UbuntuHashes).



Htop is a very powerful alternative for creating top tasks in the task manager. It provides an advanced interface with many options for monitoring and controlling system processes.

Although Htop runs in the terminal, Htop has very good support for mouse controls. This also makes it easier to complete navigation menus, select processes, and organize sorting and filtering tasks.



Links in Unix are similar to shortcuts in Windows, allowing users to quickly access certain files. Links are created by the ln command, and there are two types: hard or symbolic. Each has different properties, which are used for different objects.

The following is an example of using links. Suppose there is a directory named Scripts on the desktop. It contains the bash scripts we usually use. Whenever we want to call one of the scripts, we must do this:


This is obviously very inconvenient, because the absolute path must be written every time. Instead, we can create a symbolic link from the script folder to/usr/local/bin, which will make the script easier to execute.

sudo ln -s ~/Desktop/Scripts/git-scripts/git-cleanup/usr/local/bin/ 

By creating a symbolic link, you can call the script by simply writing the name in any open terminal.


Using the ssh command, users can quickly connect to a remote host and log in to their Unix shell. This also allows the user to directly operate the remote server from the terminal of the local machine and issue commands more conveniently.

To establish a connection, you only need to specify the correct IP address or URL. When connecting to a new server for the first time, there will be some form of authentication.

ssh username@remote_host 

If you want to quickly execute commands on the server without logging in, you can add a command after the URL. The command will run on the server and return the result.
ssh username@remote_host ls/var/www 

You can use SSH to do many things, such as creating agents and tunnels, using private keys to protect connections, transferring files, and so on. Learn more about ssh.



Grep is a standard Unix utility for finding strings in text. Grep inputs in the form of files or direct streams, runs its contents through regular expressions, and returns all matching lines.

When filtering large files, it is very convenient to use Grep. Below we use Grep and data command search to search a large log file and generate a new file containing only the error information of the day.

//Search for today's date (in format yyyy-mm-dd) and write the results to a new file. 
grep "$(date +"%Y-%m-%d")" all-errors-ever.log > today-errors.log 

Another powerful command for processing strings is  sed , which is more powerful and complex than grep. It can perform almost any string-related tasks, including adding, deleting or replacing strings.



Many Unix commands, including some of the functions in this article, will be a long list of commands after adding all the options. To make these long lists of commands easier to remember, users can use the alias command to create short aliases:

# Create an alias for starting a local web server.
alias server="python -m SimpleHTTPServer 9000"
# Instead of typing the whole command simply use the alias.
Serving HTTP on port 9000 ... 

As long as you keep the terminal open, the alias will always be available. In order to make the alias permanently available, you can also add the alias command to the .bashrc file.


Recommended front-end development tools

SpreadJS  pure front-end table control is a JavaScript spreadsheet and grid control based on HTML5. It provides a complete formula engine, sorting, filtering, input control, data visualization, Excel import/export and other functions. It is suitable for .NET, Java and mobile. Development of spreadsheet programs with online editing functions like Excel on various platforms such as terminals.



For web developers, if there are some unfamiliar commands among the above 12 terminal commands, you should quickly get familiar with them through this article and gradually apply them to your own development work.

Original link:

Please indicate the source of the reprint: Grape City Controls


About Grape City

Established in 1980, Grape City is the world's largest provider of controls, the world's leading provider of enterprise application customization tools, enterprise reports and business intelligence solutions, providing services to more than 75% of the global Fortune 500 companies. Grape City established a research and development center in China in 1988. In the process of global product research and development, it constantly adapts to the local needs of the Chinese market, and provides excellent software tools and consulting services for software companies and the informatization of various industries.

Original Published time: October 17, 2017
the original author: Grape City Technical Team

Source of this article: Open Source China     If you need to reprint, please contact the original author