From GUI to Linux CLI commands

From GUI to Linux CLI commands

What about Linux

Linux has become the widely used OS for configuration of servers, networks and cloud resources and more. It is reliable, gives more control and makes automation easy. As a result of this, transitioning from the graphical user interface (GUI) to command line interface (CLI) is expedient for majority of persons because of their chosen tech career path. Tell me if I am wrong about that in the comment, if you've had to make the switch at one point.

Transitioning from the graphical user interface to command line interface is expedient for majority of persons because of their chosen tech career path

  • GUI: allows you to interact with a computer, device or system with the help of graphical elements like icons, menus, dialog boxes etc.
  • CLI: allows you interact with a computer, device or system with the help of various commands

I just started learning devops and getting familiar with linux commands is one of the beautiful things yet.

Easy to learn Linux?

Many think Linux is so complicated that you must be geeky to use it but it is quite more flexible to use and gives you execution speed. I agree that it may look challenging at first, but that is because you're new at it. I guess it's the same for most experience at learning something new. With daily practice, you begin to find it interesting I promise. Cybersecurity professionals, network engineers, system administrators and devops geeks wouldn't agree less about this.

it is quite more flexible to use and gives you execution speed.

Want to be a Devops or Cybersecurity professional?

If you're planning to transition to devops or cybersecurity, the knowledge of linux is very crucial. Since the first release of Linux in 1991, it has continued to gain popularity because it is open source which means that people can modify and distribute it for their own purpose.

Linux is better used through the Command Line Interface (CLI), the CLI is a powerful tool that enables users perform operations that would have required several clicks and interfaces to be done by typing commands. Fast and easy init.

Linux Commands

If you have the need to get familiar with Linux command, these are some that will get you started to navigate the Linux environment.

pwd

This command simply tells you which directory or location you are working at that moment

whizjohn@jtadev:~$ pwd
/home/whizjohn

whizjohn is the name of the user active on the linux machine

jtadev is the name of the machine or host

$ indicates that one is a normal user, it usually indicates the user location at every given time as commands typed are displayed after it. If $ gets replaced with #, it means you are logged as a root or admin or superuser or sudo user i.e. you have administrative privileges

pwd this is the command that shows the present working directory

mkdir

This command is used to make (mk) directories (dir), directories are folders.

whizjohn@jtadev:~$ mkdir bridge

A new folder is created named bridge

ls

This command is used to list the files and directories in the pwd. Note that some items can be hidden and not displayed.

whizjohn@jtadev:~$ mkdir ls
bridge/    documents/   projects/    deal.txt

ls -a

This command displays hidden files and directories hidden when the ls command is executed. This hidden files usually have a . in front of their names.

whizjohn@jtadev:~$ mkdir ls -a
bridge/    documents/    .tank/   projects/    .loathe.dat    deal.txt

cd

The command cd means change directory. It is used to move around in your terminal. cd works in different ways.

  • Typing cd .. takes you back one directory while typing cd takes you to the home directory
    whizjohn@jtadev:~/bridge/lagos$ cd..
    whizjohn@jtadev:~/bridge$
    whizjohn@jtadev:~/bridge$ cd..
    whizjohn@jtadev:~$
    
  • Typing just cd moves you to the home directory.
whizjohn@jtadev:~/bridge/lagos$ cd
whizjohn@jtadev:~$
  • To move to a specific directory, paths are added; note that paths are separated with a forward slash / after each directory name.
    whizjohn@jtadev:~$ cd bridge
    whizjohn@jtadev:~/bridge$
    
    whizjohn@jtadev:~$ cd bridge/lagos
    whizjohn@jtadev:~/bridge/lagos$
    

touch

The touch command helps create files, you can create files of different extensions

whizjohn@jtadev:~/bridge$ touch slab.txt

Confirm the file is created by using the ls command to view

whizjohn@jtadev:~/bridge$ ls
lagos/     slab.txt

cat

The cat command is called concatenate command and is used to view the content of a file. Results are show below the command after you press enter

whizjohn@jtadev:~/bridge$ cat slab.txt
provider "aws" {
  region = "us-east-1"

}

rm

The rm command is used to delete files. There are different ways to use the rm command. Including -f will forcefully delete files so there is need for caution so not to loose important files. The -r option is used when deleting a directory as this allows the rm command to access children directories and delete them along with their containing file(s).

whizjohn@jtadev:~$ rm -rf bridge

sudo

The sudo command means “superuser do,” it is used to run commands with root/admin/superuser privilege level. Some processes such as installtion of new packages or changing file permissions are not allowed for a normal user, so the sudo command is used to activate root power.

whizjohn@jtadev:~$ sudo reboot

man

The -man and show you more about a command, what sub commands it has and how to use it. Similarly, the --help command does the same

whizjohn@jtadev:~$ man rm

NAME
    Remove-Item

SYNTAX
    Remove-Item [-Path] <string[]> [-Filter <string>] [-Include <string[]>] [-Exclude <string[]>] [-Recurse] [-Force] [-Credential <pscredential>] [-WhatIf]      
    [-Confirm] [-UseTransaction] [-Stream <string[]>]  [<CommonParameters>]

    Remove-Item -LiteralPath <string[]> [-Filter <string>] [-Include <string[]>] [-Exclude <string[]>] [-Recurse] [-Force] [-Credential <pscredential>]
    [-WhatIf] [-Confirm] [-UseTransaction] [-Stream <string[]>]  [<CommonParameters>]


ALIASES
    ri
    rm
    rmdir
    del
    erase
    rd

Final notes

There are so many other linux commands I did not mention, however tell me the ones you can do without and share your first linux experience in the comments.

whizjohn@jtadev:~$ echo thank you for reading
thank you for reading