No, in this article we won't go over the fundamental directions like ls, rm, and album. You shouldn't be stunned by observing those directions. You may even be very acquainted with them. Particularly in the event that you feel comfortable around the direction line really well. I accept you have in any event worked (or attempted to deal with) the direction line previously. In the event that you've never taken a shot at the order line, I propose you start by finding out about the rudiments.
This article is for those of you who have some involvement in the direction line and experienced the fundamental directions. For the individuals who feel like it's a great opportunity to plunge further into the conceivable outcomes of working with the order line. I've recorded six directions for you in this article and incorporated a few hints at the base also.
1. wget
On Unix-like operating systems, the wget command downloads files served with HTTP, HTTPS, or FTP over a network. By default, it is included in all self-respecting Linux distributions.
The most simple way to use wget is to provide it with the location of a file to download over HTTP. Downloading the file http://xyz.com/static/images/banner.jpg with wget can be done by the following command:
wget http://xyz.com/static/images/banner.jpg
One great thing about wget is that it’s non-interactive, which means that it can run in the background while the user is not logged on. This allows you to start a retrieval and disconnect from the system, letting wget finish the work.
2. scp
Ever had a problem where you needed to have a file from a remote server on your local machine? Getting a file that a user uploaded that caused some trouble, for example.
You could download this file via the command line using the scp command. Scp is short for secure copy. But what’s even more important is that it’s a remote secure copy. This command is similar to the cp command that you probably already know, but either the source or the target is on another system.
The following command copies the file foobar.txt from a remote server to a local directory.
scp username@xyz.com:/path/to/foobar.txt /some/local/directory
But scp
can also be used to copy a file from a local directory to a remote server.
The same can be done with directories using the -r
option, which copies entire directories recursively.
3. ssh-keygen
The ssh-keygen command is used to generate a new SSH key pair. The public SSH key that is generated by this command can be used in Gitlab or Bitbucket to establish a secure connection.
Once you’ve added your SSH key to either Gitlab or Bitbucket, you won’t be prompted for a password every time you try to push your files to a remote branch.
To generate an SSH key pair, use the following command:
ssh-keygen -t ed25519
Note that in the example above, we used the ED25519 signing algorithm. While ED25519 is considered best practice, you should always do some research on the different available signing algorithms.
Generating the SSH key pair and setting it up correctly in Gitlab or Bitbucket costs you ten minutes at a maximum (probably more like three) but will be totally worth it!
4. chmod
According to Wikipedia, this is the definition of the chmod command. We’ve all been in a situation where a server didn’t have access to a certain file because of a misconfiguration in the file permissions.
The chmod command is fairly simple in itself, but giving the right permissions to files and directories is a whole different game.
chmod 664 robots.txt
chmod 775 public/images
The first example gives read and write permission to user and group for the robots.txt
file. Read permission is granted to others for this file.
The second example gives read, write and execute permission to user and group for the public/images
folder. Others are granted read and execute permission for this folder.
If you want to know more about setting the right permissions to files and directories, I suggest you read the Wikipedia page about chmod
.
5. tar
The Linux tar stands for tape archive. It is used for collecting many files into one archive file. Tar is the most widely used command to create compressed archive files.
Let’s start with how you can create an archive file for a specific directory:
tar -cvf my-archive.tar /path/to/directory
This command will result in an archive file, called my-archive.tar
, that contains all files of the /path/to/directory
which is created in the current working directory.
Creating the archive file is part one. Part two consists of untarring the archive file, because at some point we want to use the files in the tar file.
5 Significant Ways AI Can Boost the User Experience in Web Apps
6. alias
Everyone uses some commands that are a little too long or complex to completely remember. Luckily, you can create an alias
for that command so you don’t have to remember the entire command.
alias short-command="your custom and very long command here"
Though creating an alias this way comes with one problem: This alias is temporary. If you create an alias this way, it will only be available for your current terminal session.
To keep aliases between sessions, you can save them in your user’s shell configuration profile file. This profile file is probably located at either ~/.bashrc or ~/.zshrc if you’re using Bash or ZSH, respectively.