AI Generated image using Jasper - depicting a penguin to represent Linux based articles.

Terminal Basic Commands

Terminal is a very powerful program that can provide valuable information and control over Linux systems. This article covers some basic commands.

 

 

Important Commands and Hot-Keys:

Tab: The Tab button will complete words or names of directories or files. You will need to have enough of the command typed out for the computer to know what word you want to finish.

Ctrl + C: AKA ‘Break.’ This key combo will stop commands that run continuously, such as Ping or Top. It also cab stop commands that just take a long time.

Man: Also known as Manual. By typing Man in front of a command you will have Terminal display the manual page for that command. An example would be Man Ping.

–Help: The –Help Terminal Command is similar to the Man command above but may provide different information and may display information in an easier to use format. Example Ping –Help

| Grep: The grep command is a command modifier that allows users to filter out results of a command. Example. Sudo Apt List –Installed | Grep SAMBA This Grep modifier will only list installed items that contain the word SAMBA.

Sudo: Use before a command to run it as an Administrator.

Tee: Allows user to output commands to a .txt file so command can be read from a file. Command is saved in the PWD.
An example of Tee would be Ping 192.168.1.1 | Tee FileNameForTeeToCreate.TXT  – The Ping command can be replaced with another command.

 

Power Commands:

systemctl suspend: This command will put the computer to sleep.

Shutdown: Will turn the computer off in about one minute.

Reboot: Will power-cycle, or restart, the computer.

 

 

Directory Terminal Commands:

CD: Change Directory allows users to change their location in the file structure in their computer. An example would be “CD Jackie/Desktop”

CD ..: Change Directory with 2 periods will take you down one directory.

CD ~: Moves Terminal session to the Root Directory.

Chgrp: Changes the group ownership of a file/directory.

Chown: Changes the ownership of a file/directory.

Chmod: Changes the access permissions of a file/directory.

 

 

Ubuntu Default Terminal Commands:

!!: Pulls the last terminal command. This command can be used with other commands such as “Sudo !!”

&&: Allows user to string multiple commands together.

Chroot Jail: Creates a Sandbox session of Linux where a user can perform tests and it should not alter the running config.

Groupadd: Creates and adds a new group.

Groupdel: Removes an existing group.

Groupmod: Creates a group name or GIDs but doesn’t add or delete members from a group.

Groups (Username): Displays all groups that requested user falls under.

Gpasswd: Creates a group password. -A sets a user as the group administrator.

Last: Shows a list of all users logged in and out since the last reboot.

Lastb:Shows a list of Failed Login Attempts.

Ping: Tests connections between network devices. (Ping 192.168.1.1 -i 0.25 -s 1250 | tee 0.TEE.PING.LOG.TXT)
By default the Ping command for the Linux Terminal will continuously ping until the break command is given, CTRL + C.

PWD: Present Working Directory. Displays current Directory location in CLI.

Sudo Apt List –Installed (Program Name): Will install certain programs from the Repositories for Ubuntu systems. Ensure there are two dashes in-front of the word Installed.

Sudo Apt Remove (Program Name): Will uninstall said program from the system.

Sudo cat /etc/shadow: Lists password information.

Sudo Apt Install (Name of Program): Will install certain programs to the computer.

TOP: Terminal version of Task Manager where the user can see how much computer resources programs are using.

Nano: In Terminal Text editor.

Nice: Sets Priorities for Processes, Groups or Usernames.

RM: Command to delete files/directories. RM -rf -r will delete everything in the directory. -f will force the deletion.

Usermod -a -g group user: Adds a user to a group

Vim: In Terminal Text editor.

W: Shows which users are currently logged into the Linux system.

WGET: Retrieves content from a webpage. The -r modifier will download whole websites with all pages that are public.

 

 

Add-on Terminal Command Packages:

Byobu: Allows ability to open multiple Terminals within one Terminal session.

NMAP: A package to give Networking information. Must have NMAP package installed.

Net-Tools: Additional network commands including the Arp commands.

SSH: Must have OpenSSH installed on terminal to use. Secure Shell Host is a secure method for connecting to other computers or servers via Terminal which grants the ability to send commands from one computer to another. An example would be. SSH [email protected]

 

 

Also Check Out: Hot Key List for Linux

Similar Posts