Wednesday, January 10, 2018

Linux Commands - Overview and Examples

https://www.howtoforge.com/linux-commands

The command line is one of the most powerful features of Linux. There
exists a sea of Linux command line tools, allowing you to do almost
everything you can think of doing on your Linux PC. However, this
usually creates a problem: with so many commands available to use, you
don't know where and how to start learning them, especially when you are
beginner.
If you are facing this issue, and are looking for an easy way to
start off your command line journey in Linux, you've come to the correct
place, as in this article, we will introduce you to a host of popular
and useful Linux commands. The article is organized in a way that you
will quickly learn what each command does through an easy to understand
example. To learn more about a command, click on the 'More...' link at
the end of its explanation.

Adduser/Addgroup

The adduser and addgroup commands lets you add a new user and group to a system, respectively. Here's an example for adduser:

Cat

The cat command allows you to concatenate files, or data
provided on standard input, and print it on the standard output. In
layman terms, the command prints the information provided to it, whether
through stdin or in the form a file.

Cp

Csplit

The csplit command lets you split a file into sections
determined by context lines. For example, to split a file into two where
the first part contains 'n-1' lines and the second contains the rest,
use the following command:

Factor

Fgrep

The fgrep command is equivalent to the grep command when
executed with the -F command line option. The tool is also known as
fixed or fast grep as it doesn't treat regular expression metacharacters as special, processing the information as simple string instead.
For example, if you want to search for dot (.) in a file, and don't
want grep to interpret it as a wildcard character, use fgrep in the
following way:

Lshw

The lshw command extracts and displays detailed information on the hardware configuration of the machine.

$ sudo lshw[sudo] password for himanshu: himanshu-desktop description: Desktop Computerproduct: To Be Filled By O.E.M. (To Be Filled By O.E.M.)vendor: To Be Filled By O.E.M.version: To Be Filled By O.E.M.serial: To Be Filled By O.E.M.width: 32 bitscapabilities: smbios-2.6 dmi-2.6 smp-1.4 smp........

Lscpu

The lscpu command displays in output system's CPU architecture information (such as number of CPUs, threads, cores, sockets, and more).

Lsof

Thelsofcommand displays
information (on stdout) related to files opened by processes. Files can
be of any type, including regular files, directories, block special
files, character special files, executing text reference, libraries,
and stream/network files.

Strings

The strings command displays in output printable
character sequences that are at least 4 characters long. It is used to
search for printable text (strings) in binary files. For example, when a
binary executable 'test' was passed as an argument to this command,
following output was produced:

Whereis

Whoami

The whoami command prints effective userid of the current user.

$ whoamihimanshu

Xargs

The xargs command builds and executes command lines from
standard input. In layman's terms, it reads items from stdin and
executes a command passed to it as an argument. For example, here's how
you can use xargs to find the word "Linux" in the files whose names are passed to it as input.