Linux Whereis Command examples
This article covers the whereis command which is useful for Locating the binaries and manual pages for various commands. Sometimes, while working on the command line, we just need to quickly find out the location of the binary file for a command.
Linux whereis command syntax
The whereis command lets users locate binary, source, and manual page files for a command. Following is its syntax:
$ whereis [options] [-BMS directory... -f] name...
Install s3cmd in Linux and Manage Amazon s3 Buckets
This article covers an overview of the s3cmd command-line tool and how you can use it to manage your Amazon S3 storage feature. S3cmd is an Open Source tool that is free for both commercial and private use, but you need to pay only for Amazon resources. so most of the users are using this tool for managing AWS S3 Buckets. S3cmd is a free command-line tool written in Python
How to use the s3cmd command line to manage the Amazon s3 bucket in Linux ?
To use s3cmd command to list s3 bucket, run the command:
# s3cmd ls
This command will list s3bucket from Amazon S3, If you are unable to get the list of the bucket then there will be the following reasons:
- There is no bucket created in Amazon s3.
- As you have used IAM user Access Key and Secret Key while configuring the s3cmd tool, please verify IAM user has required permission to access the s3 bucket.
- If you are using an IAM role then check whether the s3 bucket policy is attached to the EC2 instance or not.
List Users in Linux - Best method
This article covers how to list users in Linux system and also differentiate difference between normal user and system user. Linux OS is unique because of its multi-user characteristic allowing multiple users on one system, at the same time. However, tracking all users is essential. The /etc/passwd file contains one line for each Linux user account, with seven fields delimited by colons. This is a text file. You can easily list users under Linux using the cat command or other commands such as grep command / egrep command and more. With this same approach, you can use the Linux commands to list all users on all Linux operating system, including Ubuntu, Debian, RHEL, Arch, Fedora, CentOS, and other distros.
To list all users on Linux, use the cat command as follows:
$ cat /etc/passwd
Most Useful Nginx Commands in Linux System
This article covers most used Nginx commands. You can learn more about Nginx command line at Nginx documentation.
Nginx is one of the most popular web servers in the world. So whether you're currently using it or not, chances are, if you're a web developer chances are you'll likely come in contact with it at some point.
Also, Nginx is well known for its simple configuration, and low resource consumption due to its high performance, it is being used to power several high-traffic sites on the web, such as GitHub, SoundCloud, Dropbox, Netflix, WordPress and many others.
To start the Nginx service, run the following command. Note that this process may fail if the configuration syntax is not OK:
$ sudo systemctl start nginx #systemd
OR
$ sudo service nginx start #sysvinit
To enable Nginx auto-start at boot time, run the following command:
$ sudo systemctl enable nginx #systemd
OR
$ sudo service nginx enable #sysv init
How to Show Nginx Command Help ?
To get an easy reference guide of all Nginx commands and options, use following command.
$ systemctl -h nginx
Important Cat Command Examples in Linux
This article covers how to use the Linux cat command. Cat(concatenate) command is very frequently used in Linux. It reads data from the file and gives their content as output. It helps us to create, view, concatenate files.
If you want to add a bit of new text to an existing text file, you use the cat command to do it directly from the command line (instead of opening it in a text editor).
Type the cat command followed by the double output redirection symbol ( >> ) and the name of the file you want to add text to.
Use the Dig Command in Linux - Doing it right ?
This article covers how to query various DNS records. The dig command in Linux is used to gather DNS information. It stands for Domain Information Groper, and it collects data about Domain Name Servers. The dig command is helpful for diagnosing DNS problems, but is also used to display DNS information.
By default, dig sends the DNS query to name servers listed in the resolver(/etc/resolv.conf) unless it is asked to query a specific name server.
How to Install Dig on Linux ?
1. On Debian and Ubuntu, run:
$ apt-get install dnsutils
2. On CentOS 7, run the command:
$ yum install bind-utils
3. Once installed, check the version, to make sure the setup was completed successfully:
$ dig -v
Dig Syntax
In its simplest form, the syntax of the dig utility will look like this:
dig [server] [name] [type]
i. [server] – the IP address or hostname of the name server to query.
If the server argument is the hostname then dig will resolve the hostname before proceeding with querying the name server.
It is optional and if you don't provide a server argument then dig uses the name server listed in /etc/resolv.conf.
ii. [name] – the name of the resource record that is to be looked up.
iii. [type] – the type of query requested by dig. For example, it can be an A record, MX record, SOA record or any other types.
By default dig performs a lookup for an A record if no type argument is specified.