Are You Familiar With These Web Development Terminal Commands?
Chad Faith
Director of Content
Are you a web developer? Does the mere thought of opening a terminal window make your cringe? For the uninitiated ones, working with terminal commands during web development can be stressful, daunting, or downright annoying. However, true blue developers who know the ins and outs of the command line would agree that it is one of the best tools at their disposal.
If you would ask any experienced devs, they would tell you that the command line is imperative to modern development success, especially when custom programming is involved. You gain superior control over system functions, you can use Node Package Manager to facilitate package installs, you gain access to preprocessors, and more! So, let’s put your knowledge to the test. Start by asking yourself whether you are familiar with the following terminal commands!
Grep
Grep is recognized as the main Unix utility for locating specific strings inside a bunch of text. It can accept inputs as a direct stream or a file. Its then runs its content through a regular expression before returning all the matching lines. If you usually work with large files that need to be filtered, the Grep command will quickly become handy. You not only can search through large log files but also generate a new file containing only errors. Need something more powerful than Grep? Try “sed”. It can complete virtually any string-related task including replacing, removing, or adding strings.
SSH
Developers can use the SSH command to rapidly link up with a remote host. This also allows SSH command users to log into its Unix shell. With that, you can conveniently issue commands from your local machine’s terminal. To establish a connection, the first step is to specify the correct URL or IP address. If you are connecting to a new server, you will need to go through an authentication process.
Yes, it is possible to execute a command on the server without going through a login process. In this case, just add a command after the URL. The command will run on the server and you will receive results directly from it. SSH has many more functions, including the creation of tunnels and proxies, transferring files, using private keys to secure your connection over an unsecure network, and more.
Tar
When it comes to working with file archives, Tar is the default Unix tool fit for the job. Tar allows developers to bundle multiple files quickly into one package. This makes moving them at a later time and storing them much easier. You can even use the -x option to extract existing .tar archives! Unfortunately, tar cannot work with formats such as .rar and .zip. You will need alternate utilities such as unzip. Today, a wide variety of modern Unix systems run GNU tar – it is an expanded version of tar. This version of tar can perform file size compression. Alternatively, you can use compress, zcat, or gzip to reduce the size of file archives.
Tmux
Tmux is a terminal multiplexer – it connects multiple terminals to a single terminal session. If you need to attach multiple terminals to the same session, switch between programs in one terminal, or add one or more split screen panes, Tmux is a stellar terminal command. If you are working on a remote server, you will be pleased that Tmux allows you to create new tabs without having to log in repeatedly!
If you set aside time to master these terminal commands (there are many more!), you may be surprised how much power you can leverage from a little black window.