50+ Linux Commands List with Examples | DataTrained

Chandrakishor Gupta Avatar

Introduction

Based on the Linux Kernel, the Linux operating system family is an open-source group of Unix systems. Linux commands, They consist of Red Hat, Fedora, Debian, openSUSE, and Ubuntu. It is common practice to manage a Virtual Private Server (VPS) using Linux.

You must utilize a shell when using Linux, a program that allows you access to the system’s features. Linux Commands, The majority of Linux command distributions employ a GUI, making them user-friendly for beginners.

What is Linux?

What is Linux?

An application or tool that runs on the CLI, a console that communicates with the system through texts and processes, is known as a Linux commands. It resembles Windows’ Command Prompt program in many ways.

By hitting Enter at the end of the line, Linux commands are carried out in the Terminal. features of linux, You may use commands to carry out a range of operations, including managing users, installing packages, and manipulating files. Keep in mind that case matters when using any Linux commands.

Here is the list of basic Linux commands

Here is the list of basic Linux commands

Commands

Description

access

used to determine if the caller program has permission to access a particular file. It can be used to determine whether or not a file is present.

Accton

used to update the information process for accounting files or turn on or off the accounting process

aclocal

used to create aclocal.m4 files from the configure.in the file automatically.

acpi

used to show the battery condition and additional ACPI data

banner

used to print a huge letter ASCII character string to standard output.

basename

It outputs the file name NAME with any leading directory components removed, and it removes suffixes from file names.

batch

used to execute instructions when system load levels permit, i.e. when the load average drops below 1.5, by reading them from standard input or a specified file.

bc

Used with a command-line calculator

case

When we had to employ numerous if/elif statements on a single variable, this was the best option.

cat

reads data from a file and outputs its contents. It facilitates file creation, viewing, and concatenation.

cc

The C language is compiled using it to produce executables.

ccrypt

It is a utility for command-line data encryption and decryption.

date

used to show the time and date on the system. It is also used to set the system’s date and time.

dc

used to assess mathematical expressions. Expressions evaluated by it take the form of postfix expressions.

df

used to show file system statistics such as total capacity and available space

diff

used to compare the files line by line in order to display the differences in the files.

echo

displayed when a line of text or string is supplied as an argument.

ed

used to open the ed text editor, a line-based text editor with a straightforward interface that makes working with text files—creating, editing, displaying, and modifying files—less complicated

egrep

The lines that match the pattern are printed after treating the pattern like an extended regular expression.

enable

used to start the classes or the printer.

factor

used to print the prime factors of the specified numbers, which can be either command-line- or standard-input-provided.

fold

Each line in an input file is wrapped to fit a predetermined width before being printed on the standard output.

for

used to repeatedly run a set of instructions for each entry in the list

function

used to develop methods or functions

g++

used to produce executable files by preprocessing, compiling, assembling, and linking source code.

gawk

used for language processing and pattern recognition

gcc

GNU Compiler Collections is used mostly to compile the languages C and C++. Compiling Objective C and Objective C++ is another usage for it.

gdb

The GNU Debugger tool is useful for debugging C, C++, Ada, Fortran, and other programming languages.

halt

used to tell the hardware to halt all CPU operations. In essence, it restarts or shuts down the system.

hash

used to keep track of recently run programs in a hash table.

Head

prints the top N numbers of the input’s data.

help

information about the built-in commands of the shell

if

used to carry out directives in response to situations

import

used to take a screenshot of any of our active pages, and it outputs the snapshot as an image file.

info

reads information-format documentation. When compared to the home page, it will provide comprehensive details for a command.

install

used to set attributes and copy files

join

Usi
ng a key field that is present in both files, it is a command-line tool for combining lines from two files.

journalctl

examine system, kernel, and journal logs using this

kill

used to manually end processes. The kill command sends a signal to a process, ending it.

last

used to show a list of all users who have logged in and out since the creation of the file /var/log/wtmp.

less

used to display the text file’s contents one page at a time.

locate

used to find files using their names

look

displays the lines that begin with a specified string.

mailq

This Linux commands displays the mail queue or a list of all the emails that are currently in the mail queue.

man

used to show the user guide for any command we can enter into the terminal.

md5sum

Using the MD5 (Message-Digest Algorithm) to check the integrity of the data

mkdir

permits user directory creation. Multiple folders can be created at once using this command.

nc(netcat)

One of the most effective network monitoring, security, or networking tools is this one.

netstat

displays a variety of network-related data, including connections to networks, routing tables, interface statistics, connections made via the masquerade protocol, multicast memberships, etc.

nmcli

utilised to manage NetworkManager. Additionally, the nmcli command can be used to create, edit, activate/deactivate, and delete network connections as well as display network device status.

nslookup

It is a network administration utility for asking the Domain Name System (DNS) for any given DNS record, domain name mapping, or IP address mapping.

od

utilised to convert input content between various formats, with octal format serving as the default format

passwd

used to modify user account passwords

paste

Used to connect files horizontally (parallel merging) by printing lines to standard output made up of lines from each of the supplied files, separated by tabs as delimiters.

ping

used to test network connectivity between a server and a host

poweroff

sends an ACPI signal to tell the system to turn off.

read

reads into the buffer the total number of bytes from the supplied file descriptor.

rename

uses the regular expression perlexpr to rename the named files.

reset

utilized to set up the terminal. This is helpful when a program crashes and leaves a terminal in an odd condition.

restore

used to recover files from backups made with dump

sleep

used to produce a fake job. Using a phantom job delays the execution.

source

used as an argument in the current shell script to read and execute the contents of a file (often a sequence of commands).

sort

used to organize the entries in a file so that it may be sorted

split

a technique for dividing huge files into smaller pieces.

sudo

used as a prefix for a command that can only be run by the superuser

sum

used to count the blocks in a file and find the checksum

sync

used to coordinate cached writes with permanent storage

Tail

prints the N-th row of data from the supplied input.

time

used to run a command and, when it finishes, output a summary of the real-time, user, and system CPU time used to run the command.

top

gives a dynamic perspective of the active system in real-time.

type

Used to describe how its argument would be translated if used as commands

uname

Displays the information about the system

until

Used to execute a set of commands as long as the final command in the ‘until’ Commands has an exit status which is not zero

Note:- click here to learn about coding

Apt-Get Command

Apt-Get Command

A command-line utility for managing Advanced Package utility (APT) libraries in Linux is called apt-get. linux commands, To manage, update, delete, and install software and its dependencies, you can retrieve data and bundles from trusted sources.

You must need sudo or root capabilities to run the apt-get command.

This is the primary syntax:

(Command) apt-get [options]

The most typical commands you can add to apt-get are as follows:

  1. The package files are synchronized via updates from their sources.
  2. All installed packages are upgraded when they are upgraded.
  3. The package cache is updated, and broken dependencies are checked.

You can also click here to know: about data science course India

Cd command

cat command

Use the cd command to move between Linux files and commands. It needs either the whole path or the directory name, depending on your current working directory.

You will be sent to t
he home folder if you use this command without a parameter. linux commands, Remember that it can only be executed by users who have sudo rights.

You must type cd followed by the absolute path of the new directory you want to access, for instance, Linux Commands,  /home/username/Movies:

movies in /home/username/

Here are several navigational shortcuts:

  • cd [username] navigates to the home directory of a different user.
  • Moving one directory up with cd.
  • To return to your previous directory, type cd.

Cat command

One of the most often used Linux commands is concatenated, or cat. The file content is listed, combined, and sent to standard output. linux commandsType cat, the file name, and its extension to execute the cat command. Using cat filename.txt as an example.

Other applications for the cat command include:

  • Create a new file by typing cat > filename.txt.
  • The output of the command cat filename1.txt filename2.txt > filename3.txt is stored in filename3.txt.
  • Content is displayed in reverse order using tac filename.txt.

df command

To display the percentage and kilobyte (KB) consumption of the system’s disc space, use the df command. This is the basic syntax:

the df [options] [file]

If you wish to check the system disc space consumption for the current directory in a human-readable format, linux commands, for instance, enter the following Linux command:

df -h

Some suitable choices are as follows:

  • The file system used is shown with df -m in terms of megabytes.
  • File system used is shown via df -k in KBs.
  • The file system type is displayed in a new column by df -T.

Rcho command

The echo command is a built-in tool that uses the standard output to display a line of text or string. Linux Commands, The basic syntax is as follows:

[Option] echo [string]

For instance, by typing: you can make the text Hostinger Tutorials visible.

“Hostinger Tutorials” is echoed.

Many options are supported by this command, including:

  1. The output is shown with the -n flag sans the last new line.
  2. The following backslash escapes are interpretable with the use of the -e flag:
  3. A sound alert is played.
  4. B eliminates gaps within a text.
  5. There is no more production from c.
  6. -E shows the default setting and turns off the backslash escape interpretation.

Also read: data science course chennai

find command

To find files in a certain directory and carry out further activities, use the find command. This is the basic syntax:

find [option] [path] [expression]

For instance, Linux Commands, you should search the home directory and its subfolders for a file named notes.txt:

locate /home notes.txt -name

Here are some additional discover variations:

  • To find files in the current directory, type find -name filename.txt.
  • To search for directories, type find./ -type d -name directoryname

Grep command

Global regular expression print, or grep, is another of the fundamental inux commands on the list. linux commands, By searching through all the texts in a particular file, you can locate a term.

The grep command prints all lines that match the particular pattern as soon as it finds a match. Linux Commands, Large log files can be filtered through using this command.

For instance, you might use the command grep blue notepad.txt to look for the word blue in the text file.

The command’s output will show lines with blue text.

Head command

You can view the first ten lines of a text with the head command. The number of lines displayed can be altered by adding an option. Linux Commands, Piped data can also be output to the CLI using the head command.

This is the basic syntax:

skull [option] [file]

In the current directory, note.txt, you might want to read the first ten lines, as in the following example:

text file headed

Here are some additional choices you have:

  1. The initial number of lines specified by -n or -lines is printed. To display the first five lines of filename.txt, for instance, Linux Commands, type head -n 5 filename.txt.
  2. The first specified number of bytes of each file is printed using the options -c or -bytes.
  3. No file name headers will be printed when using the -q or -quiet options.

ls command

A system’s files and directories are listed using the ls command. It will display the contents of the current working directory when run without a flag or parameter.

Type ls followed by the appropriate path to view the contents of other directories. Linux Commands, For instance, use ls /home/username/Documents to browse files in the Documents folder.

You can use the ls command with the following options:

  1. All of the files in the subdirectories are listed by ls -R.
  2. LSA displays hidden files in addition to those that are visible.
  3. The file sizes are displayed by ls -lh in readable formats like MB, GB, and TB.

kill command

To manually end an unresponsive program, Linux Commands, use the kill command. Applications that are acting inappropriately will be warned and told to stop their processes.

You need to know a program’s process identification number (PID) in order to terminate it. Run the following Linux commands if you don’t know the PID:

Ps UX

Enter the following syntax after knowing the signal to use and the program’s PID: kill [signal_option] pid

There are 64 different signals available, but these two are among the most widely utilized ones:

  1. SIGTERM offers a program the opportunity to save all of its progress before asking it to halt. Linux Commands, If you enter the kill command without specifying the signal, the system will utilize this by default.
  2. Programs are forced to stop by SIGKILL, and all unsaved progress will be lost.

man command

Any commands or utilities you can use in Terminal are listed in the man command, Linux Commands, along with their name, description, and available arguments.

It is divided into nine sections:

  1. programs that can be run or shell commands
  2. Device calls
  3. calling libraries
  4. Special files for games
  5. formats and conventions for files
  6. commands for system administration
  7. Kernel operations

Miscellaneous

Type: man [command_name] to view the entire manual.

ps command

A snapshot of all active processes on your system is created by the process status or ps command. Linux Commands, The virtual files in the /proc file system are used to generate the static results.

The running processes in the shell will be listed when the ps command is performed without an option or argument, along with:

  1. The distinct process ID (PID) is
  2. The terminal’s (TTY) type
  3. The duration (TIME)
  4. The (CMD) command that initiates the process

Rmdir command

Use the rmdir command to permanently remove a directory that is empty. Linux Commands, It’s important to keep in mind that the user performing this command needs to have sudo access to the parent directory.

For instance, let’s say you wish to delete the main folder mydir and the empty subdirectory personal1:

rmdir -p mydir/personal1

Top command

The top command in Linux Terminal will show a dynamic real-time view of the current system along with all the processes that are now active. Linux Commands, It summarises resource usage, Linux Commands, including CPU and memory usage.

You can locate and end a process that may be utilizing excessive amounts of system resources by using the top command.

Simply type top into the CLI to execute the command.

zip, unzip commands

To compress your files into a ZIP file, a universal format frequently used on Linux, use the zip command. Linux Commands, It is capable of picking the ideal compression ratio automatically.

Additionally helpful for archiving files and directories and minimizing disc consumption is the zip command.

Enter the following syntax to utilize it:

zip [options] file1 file2, zipfile…

If, for instance, you want to compress note.txt into archive.zip in the current directory:

Zip files.zip note.txt

The unzip command, on the other hand, extracts zipped files from an archive. The basic format is as follows:

[Option] unzip file_name.zip

Therefore, type: unzip archive.zip to unzip a file named archive.zip in the current directory.

Conclusion

You may quickly and efficiently complete administrative and fundamental chores via the Terminal using Linux commands. You’ll be able to access functions that aren’t always accessible through a graphical user interface and have more control over your system using it.

To communicate with your machine, Linux Commands, especially if you utilize a Virtual Private Server (VPS), you must learn some fundamental Linux commands. Each utility typically has three components: a command name, a flag or option, and a parameter or argument.

Frequently Asked Questions

What is Linux commands used for?

An application or tool that runs on the CLI, a console that communicates with the system through texts and processes, is known as a Linux command. It resembles Windows’ Command Prompt programme in many ways. By hitting Enter at the end of the line, Linux commands are carried out in the Terminal.

Lovable Intellect Not Using XP is the complete form of LINUX. Linus Torvalds created and is the creator of Linux.

It offers a mechanism for users to operate their system’s commands, browse files, install software, and carry out numerous tasks without requiring a graphical user interface (GUI). The default terminal emulator in Linux is known as “Bash,” which is an acronym for Bourne-again shell.

Early in the 1990s, Finnish software developer Linus Torvalds and the Free Software Foundation (FSF) developed the Linux operating system for computers. Torvalds began working on Linux while still a student at the University of Helsinki to construct a system like the UNIX operating system MINIX.

 

Furthermore, Linux is more secure than many other operating systems and doesn’t need antivirus software to keep users safe. Linux also provides a high level of stability, needs little disc space, has strong networking capabilities, and gives the user control over programme updates.

Tagged in :

UNLOCK THE PATH TO SUCCESS

We will help you achieve your goal. Just fill in your details, and we'll reach out to provide guidance and support.