How to Use a Common Command Line on a Linux
The Linux command line is a powerful place to be, and that power is available to a Windows user as well. Now everyone can take complete control of their own computers.
The Linux command line is a place that the majority of computer users will never have been to. However, it is a place well worth visiting. That's because it gives the Linux user a vast array of powerful tools which are otherwise invisible to them. For example they can:
- manage and manipulate files
- compress and decompress files
- search files for strings
- see what processes are running
- find out how much disk spaces is being used and which files are using that space
And the Windows user needn't feel left out, although they will need to install the Cygwin environment to obtain the full range of tools available to the Linux user.
Getting to the Linux Command Line
The command line is a simple GUI (Graphical User Interface) and is accessed by.
- running a terminal (or console) application (such as xterm) on Linux
- running the Cygwin Bash Shell on Windows
The user can then use this to enter and run commands (as shown in figure 1 at the bottom of this article).
Finding Out What's Available
One thing that new Linux (or Linux-like) command line users will find interesting (if not a little disconcerting) is the naming of some of the commands. Some are self explanatory:
- whoami – outputs the current user id
- who – lists every logged on
- file – returns a file type
- find – searches for a file
- env – displays the system environment variables
However, some command names are more obscure:
- grep – searches a file for a string
- tar – compresses a file (or files)
- gawk – processes file contents
At this point there are two crucial commands that the user needs to be aware of:
- man – the Linux manual pages
- info – the Linux information documents
The user can, therefore obtain information on a command by typing (for example:
man grep
or
info grep
In this case the user would be able to read about the usage of the grep command. And it's also worth knowing that key words (or phrases) can be searched for. For example:
man -k search
or:
info – k search
will return all subjects relevant to that key word. However, the man search facility does tend to be more limited than the info search.
Joining Commands Together
Each of the Linux commands is very useful in it's own right, for example:
- ps – lists all running processes
- ps -W – lists all running processes on a Windows pc
- wc – counts the lines, words and characters in file
- wc -l – counts the lines in a file
However, they are made even more useful when joined together. And that's where the pipe comes in. The pipe sends the output of one command to the input of another. For example, the user can combine ps and wc to calculate the number of processes running on a Windows computer:
ps -W | wc -l
And so, by turning to the command line and combining Linux's in-built commands, the user can take control of every aspect of their computer's activities.
Posted on Utopian.io - Rewarding Open Source Contributors
Your contribution cannot be approved yet because it is not as informative as other contributions. See the Utopian Rules. Please edit your contribution and add try to improve the length and detail of your contribution (or add more images/mockups/screenshots), to reapply for approval.
You may edit your post here, as shown below:
You can contact us on Discord.
[utopian-moderator]
Your contribution cannot be approved because it does not follow the Utopian Rules. You didn't responded to my comment in 48 hours.
You can contact us on Discord.
[utopian-moderator]