Which of the following Linux commands utilities can be used to edit a file?

As of writing this, Linux has a worldwide market share of 2.68% on desktops, but over 90% of all cloud infrastructure and hosting services run in this operating system. For this reason alone, it is crucial to be familiar with popular Linux commands.

According to the 2020 StackOverflow survey, Linux is the most-used operating system by professional developers, with an impressive 55.9% of the market share. It isn’t just a coincidence. Linux is free and open-source, has better security than its competitors, and boasts a powerful command line that makes developers and power users more effective. You also have access to a powerful package manager and a bunch of development tools like DevKinsta.

Whether you’re an experienced Sysadmin or a Linux newcomer, you can take advantage of this guide.

Let’s begin!

What Is a Linux Command?

A Linux command is a program or utility that runs on the command line. A command line is an interface that accepts lines of text and processes them into instructions for your computer.

Any graphical user interface (GUI) is just an abstraction of command-line programs. For example, when you close a window by clicking on the “X,” there’s a command running behind that action.

A flag is a way we can pass options to the command you run. Most Linux commands have a help page that we can call with the flag cd Videos7. Most of the time, flags are optional.

Kinsta spoiled me so bad that I demand that level of service from every provider now. We also try to be at that level with our SaaS tool support.

Suganthan Mohanadasan from @Suganthanmn
View plans

An argument or parameter is the input we give to a command so it can run properly. In most cases, the argument is a file path, but it can be anything you type in the terminal.

You can invoke flags using hyphens (cd Videos8) and double hyphens (cd Videos9), while argument execution depends on the order in which you pass them to the function.

Did you know that 90% of all cloud infrastructure and hosting services use Linux? 🤯 For this reason alone, it is crucial to be familiar with popular Linux commands. ⬇️Click to Tweet

The Most-Used Linux Commands

Before jumping into the most-used Linux commands, make sure to fire up a terminal. In most Linux distributions, you would use Ctrl + Alt + T to do so. If this isn’t working, search in your application panel for “terminal.”

The Linux terminal emulator.

Now let’s dive into the 40 most-used Linux commands. Many of these have multiple options you can string to them, so make sure to check out the commands’ manual.

1. cd /home/kinsta/Documents/Videos0 Command

cd /home/kinsta/Documents/Videos0 is probably the first command every Linux user typed in their terminal. It allows you to list the contents of the directory you want (the current directory by default), including files and other nested directories.

ls

It has many options, so it might be good to get some help by using the cd /home/kinsta/Documents/Videos2 flag. This flag returns all the flags you can use with ls.

For example, to colorize the output of the cd /home/kinsta/Documents/Videos0 command, you can use the following:

ls --color=auto
The colorized ls command.

Now the cd /home/kinsta/Documents/Videos0 command output is colorized, and you can appreciate the difference between a directory and a file.

But typing cd /home/kinsta/Documents/Videos0 with the color flag would be inefficient; that’s why we use the cd /home/kinsta/Documents/Videos6 command.

2. cd /home/kinsta/Documents/Videos6 Command

The cd /home/kinsta/Documents/Videos6 command lets you define temporary aliases in your shell session. When creating an alias, you instruct your shell to replace a word with a series of commands.

For example, to set cd /home/kinsta/Documents/Videos0 to have color without typing the cd0 flag every time, you would use:

alias ls="ls --color=auto"

As you can see, the cd /home/kinsta/Documents/Videos6 command takes one key-value pair parameter: cd2. Note that the value must be inside quotes.

If you want to list all the aliases you have in your shell session, you can run the cd /home/kinsta/Documents/Videos6 command without argument.

alias
The alias command.

3. cd4 Command

As the name suggests, the cd4 command aims to remove an cd /home/kinsta/Documents/Videos6 from the already defined aliases. To remove the previous cd /home/kinsta/Documents/Videos0 alias, you can use:

unalias ls

4. cd8 Command

The cd8 command stands for “print working directory,” and it outputs the absolute path of the directory you’re in. For example, if your username is “john” and you’re in your Documents directory, its absolute path would be: cd ..0.

To use it, simply type cd8 in the terminal:

pwd # My result: /home/kinsta/Documents/linux-commands

5. cd ..2 Command

The cd ..2 command is highly popular, along with cd /home/kinsta/Documents/Videos0. It refers to “change directory” and, as its name suggests, switches you to the directory you’re trying to access.

For instance, if you’re inside your Documents directory and you’re trying to access one of its subfolders called Videos, you can enter it by typing:

cd Videos

You can also supply the absolute path of the folder:

cd /home/kinsta/Documents/Videos

There are some tricks with the cd ..2 command that can save you a lot of time when playing around with it:

1. Go to the home folder

cd

2. Move a level up

cd ..

3. Return to the previous directory

ls --color=auto0

6. cd ..6 Command

It’s so easy to copy files and folders directly in the Linux terminal that sometimes it can replace conventional file managers.

To use the cd ..6 command, just type it along with the source and destination files:

ls --color=auto1

You can also copy entire directories by using the recursive flag:

ls --color=auto2

Remember that in Linux, folders end with a forward slash (cd ..8).

7. cd ..9 Command

Now that you know how to copy files, it’ll be helpful to know how to remove them.

You can use the cd ..9 command to remove files and directories. Be careful while using it, though, because it’s very difficult (yet not impossible) to recover files deleted this way.

To delete a regular file, you’d type:

ls --color=auto3

If you want to delete an empty directory, you can use the recursive (ls --color=auto01) flag:

ls --color=auto4

On the other hand, to remove a directory with content inside of it, you need to use the force (-f) and recursive flags:

ls --color=auto5

Info

Be careful with this — you can erase a whole day of work by misusing these two flags!


8. ls --color=auto02 Command

You use the ls --color=auto02 command to move (or rename) files and directories through your file system.

To use this command, you’d type its name with the source and destination files:

ls --color=auto6

To utilize absolute paths, you’d use:

ls --color=auto7

…where ls --color=auto04 is the directory you’re currently in.

You also can use ls --color=auto02 to rename files while keeping them in the same directory:

ls --color=auto8

9. ls --color=auto06 Command

To create folders in the shell, you use the ls --color=auto06 command. Just specify the new folder’s name, ensure it doesn’t exist, and you’re ready to go.

For example, to make a directory to keep all of your images, just type:

ls --color=auto9

To create subdirectories with a simple command, use the parent (ls --color=auto08) flag:

alias ls="ls --color=auto"0

10. ls --color=auto09 Command

Another essential Linux command is ls --color=auto09. It displays the manual page of any other command (as long as it has one).

To see the manual page of the ls --color=auto06 command, type:

alias ls="ls --color=auto"1

You could even refer to the ls --color=auto09 manual page:

alias ls="ls --color=auto"2
The manual page of “man.”

11. ls --color=auto13 Command

The ls --color=auto13 command allows you to update the access and modification times of the specified files.

For example, I have an old file that was last modified on April 12th:

Old date.

To change its modification date to the current time, we need to use the ls --color=auto15 flag:

alias ls="ls --color=auto"3

Now the date matches today’s date (which at the time of writing was August 8th).

New date

Nonetheless, most of the time, you won’t use ls --color=auto13 to modify file dates, but rather to create new empty files:

alias ls="ls --color=auto"4

12. ls --color=auto17 Command

The ls --color=auto17 command lets you change the mode of a file (permissions) quickly. It has a lot of options available with it.

The basic permissions a file can have are:

  • r (read)
  • w (write)
  • x (execute)

One of the most common use cases for ls --color=auto17 is to make a file executable by the user. To do this, type ls --color=auto17 and the flag ls --color=auto21, followed by the file you want to modify permissions on:

alias ls="ls --color=auto"5

You use this to make scripts executable, allowing you to run them directly by using the ls --color=auto04 notation.

13. ls --color=auto04 Command

Maybe the ls --color=auto04 notation isn’t a command itself, but it’s worth mentioning in this list. It lets your shell run an executable file with any interpreter installed in your system directly from the terminal. No more double-clicking a file in a graphical file manager!

For instance, with this command, you can run a Python script or a program only available in .run format, like XAMPP. When running an executable, make sure it has executable (x) permissions, which you can modify with the ls --color=auto17 command.

Here’s a simple Python script and how we would run it with the ls --color=auto04 notation:

alias ls="ls --color=auto"6

Here’s how we’d convert the script into an executable and run it:

alias ls="ls --color=auto"7

14. ls --color=auto27 Command

The ls --color=auto27 command does exactly what its name suggests: With it, you can end a shell session and, in most cases, automatically close the terminal you’re using:

alias ls="ls --color=auto"8

15. ls --color=auto29 Command

This command stands for “superuser do,” and it lets you act as a superuser or root user while you’re running a specific command. It’s how Linux protects itself and prevents users from accidentally modifying the machine’s filesystem or installing inappropriate packages.

Sudo is commonly used to install software or to edit files outside the user’s home directory:

alias ls="ls --color=auto"9

It’ll ask you for the administrator’s password before running the command you typed after it.

16. ls --color=auto30 Command

As you may guess, the ls --color=auto30 command lets you power off your machine. However, it also can be used to halt and reboot it.

To power off your computer immediately (the default is one minute), type:

alias0

You can also schedule to turn off your system in a 24-hour format:

alias1

To cancel a previous ls --color=auto30 call, you can use the ls --color=auto33 flag:

alias2

17. ls --color=auto34 Command

ls --color=auto34 is an interactive process viewer that lets you manage your machine’s resources directly from the terminal. In most cases, it isn’t installed d by default, so make sure to read more about it on its download page.

Sign Up For the Newsletter

Want to know how we increased our traffic over 1000%?

Join 20,000+ others who get our weekly newsletter with insider WordPress tips!

Subscribe Now

alias3
The “htop” interface.

18. ls --color=auto36 Command

The unzip command allows you to extract the content of a .zip file from the terminal. Once again, this package may not be installed by default, so make sure you install it with your package manager.

Here, we’re unpacking a .zip file full of images:

alias4

19. ls --color=auto37, ls --color=auto38, ls --color=auto39 commands

No matter which Linux distribution you’re using, it’s likely that you use package managers to install, update, and remove the software you use every day.

You can access these package managers through the command line, and you’d use one or another depending on the distro your machine is running.

The following examples will install GIMP, a free and open source software usually available in most package managers:

1. Debian-based (Ubuntu, Linux Mint)

alias5

2. Red Hat-based (Fedora, CentOS)

alias6

3. Arch-based (Manjaro, Arco Linux)

alias7

20. ls --color=auto40 Command

The ls --color=auto40 command displays defined text in the terminal — it’s that simple:

alias8
The echo command

Its primary usage is to print environmental variables inside those messages:

alias9

21. ls --color=auto42 Command

ls --color=auto43, short for “concatenate,” lets you create, view, and concatenate files directly from the terminal. It’s mainly used to preview a file without opening a graphical text editor:

unalias ls0
The cat command.

22. ls --color=auto44 Command

With ls --color=auto44, you can take a look at the processes your current shell session is running. It prints useful information about the programs you’re running, like process ID, TTY (TeleTYpewriter), time, and command name.

unalias ls1
The ps command.

In case you want something more interactive, you can use ls --color=auto34.

23. ls --color=auto47 Command

It’s annoying when a program is unresponsive, and you can’t close it by any means. Fortunately, the ls --color=auto47 command solves this kind of problem.

Simply put, ls --color=auto47 sends a TERM or kill signal to a process that terminates it.

You can kill processes by entering either the PID (processes ID) or the program’s binary name:

unalias ls2

Be careful with this command — with ls --color=auto47, you run the risk of accidentally deleting the work you’ve been doing.

24. ls --color=auto51 Command

ls --color=auto51 is the most popular networking terminal utility used to test network connectivity. ls --color=auto51 has a ton of options, but in most cases, you’ll use it to request a domain or IP address:

unalias ls3

25. ls --color=auto54 Command

ls --color=auto54 is a free and open source terminal text editor that’s in used since the ’90s. It lets you edit plain text files using efficient keybindings.

Some people consider it difficult to use — exiting Vim is one of the most-viewed StackOverflow questions — but once you get used to it, it becomes your best ally in the command line.

To fire up Vim, just type:

All Kinsta hosting plans include 24/7 support from our veteran WordPress developers and engineers. Chat with the same team that backs our Fortune 500 clients. Check out our plans!

unalias ls4
The vim text editor.

26. ls --color=auto56 Command

If you’re struggling to remember a command, ls --color=auto56 comes in handy. This command displays an enumerated list with the commands you’ve used in the past:

unalias ls5
The history command.

27. ls --color=auto58 Command

ls --color=auto58 allows you to change the passwords of user accounts. First, it prompts you to enter your current password, then asks you for a new password and confirmation.

It’s similar to any other change of password you’ve seen elsewhere, but in this case, it’s directly in your terminal:

unalias ls6
The passwd command

Be careful while using it — you don’t want to mess up your user password!

28. ls --color=auto60 Command

The ls --color=auto60 command outputs the full path of shell commands. If it can’t recognize the given command, it’ll throw an error.

For example, we can use this to check the binary path for Python and the Brave web browser:

unalias ls7

29. ls --color=auto62 Command

If you ever wanted a file to be almost impossible to recover, ls --color=auto62 can help you with this task. This command overrides the contents of a file repeatedly, and as a result, the given file becomes extremely difficult to recover.

Here’s a file with little content in it:

File to shred.

Now, let’s have ls --color=auto62 do its thing by typing the following command:

unalias ls8
Overwritten content.

If you want to delete the file right away, you can use the ls --color=auto65 flag:

unalias ls9

30. ls --color=auto66 Command

ls --color=auto66 (opposite of more) is a program that lets you inspect files backward and forward:

pwd # My result: /home/kinsta/Documents/linux-commands0
The less command.

The neat thing about ls --color=auto66 is that it includes more and ls --color=auto54 commands in its interface. If you need something more interactive than ls --color=auto42, ls --color=auto66 is a good option.

31. ls --color=auto72 Command

Similar to ls --color=auto42, ls --color=auto72 prints the contents of a file with one major caveat: It only outputs the last lines. By default, it prints the last 10 lines, but you can modify that number with ls --color=auto75.

For example, to print the last lines of a large text file, you’d use:

pwd # My result: /home/kinsta/Documents/linux-commands1
The tail command.

To view only the last four lines:

pwd # My result: /home/kinsta/Documents/linux-commands2
tail four lines.

32. ls --color=auto76 Command

This one is complementary to the ls --color=auto72 command. ls --color=auto76 outputs the first 10 lines of a text file, but you can set any number of lines you want to display with the ls --color=auto75 flag:

pwd # My result: /home/kinsta/Documents/linux-commands3
The head command.

33. ls --color=auto80 Command

Grep is one of the most powerful utilities for working with text files. It searches for lines that match a regular expression and print them:

pwd # My result: /home/kinsta/Documents/linux-commands4
The grep command.

You can count the number of times the pattern repeats by using the ls --color=auto33 flag:

pwd # My result: /home/kinsta/Documents/linux-commands5

34. ls --color=auto82 Command

The ls --color=auto82 command (short for “who am i”) displays the username currently in use:

pwd # My result: /home/kinsta/Documents/linux-commands6

You would get the same result by using ls --color=auto40 and the environmental variable $USER:

pwd # My result: /home/kinsta/Documents/linux-commands7

35. ls --color=auto85 Command

ls --color=auto85 prints a single-line description of any other command, making it a helpful reference:

pwd # My result: /home/kinsta/Documents/linux-commands8

36. ls --color=auto87 Command

Wc stands for “word count,” and as the name suggests, it returns the number of words in a text file:

pwd # My result: /home/kinsta/Documents/linux-commands9

Let’s breakdown the output of this command:

  • 37 lines
  • 207 words
  • 1000 byte-size
  • The name of the file (long.txt)

If you only need the number of words, use the ls --color=auto88 flag:

cd Videos0

37. ls --color=auto89 Command

ls --color=auto89(short for “Unix name”) prints the operative system information, which comes in handy when you know your current Linux version.

Most of the time, you’ll be using the ls --color=auto91 (–all) flag, since the default output isn’t that useful:

cd Videos1

38. ls --color=auto92 Command

Neofetch is a CLI (command-line interface) tool that displays information about your system — like kernel version, shell, and hardware — next to an ASCII logo of your Linux distro:

cd Videos2
The neofetch command.

In most machines, this command isn’t available by default, so make sure to install it with your package manager first.

39. ls --color=auto93 Command

The ls --color=auto93 command searches for files in a directory hierarchy based on a regex expression. To use it, follow the syntax below:

cd Videos3

To search for a file named long.txt in the current directory, enter this:

cd Videos4

To search for files that end with a .py (Python) extension, you can use the following command:

cd Videos5

40. ls --color=auto95 Command

ls --color=auto95 (World Wide Web get) is a utility to retrieve content from the internet. It has one of the largest collections of flags out there.

Here’s how you would download a Python file from a GitHub repo:

cd Videos6

Linux Commands Cheat Sheet

Whenever you want a quick reference, just review the below table:

CommandUsagecd /home/kinsta/Documents/Videos0Lists the content of a directorycd /home/kinsta/Documents/Videos6Define or display aliasescd4Remove cd /home/kinsta/Documents/Videos6 definitionscd8Prints the working directorycd ..2Changes directorycd ..6Copies files and directoriescd ..9Remove files and directoriesls --color=auto02Moves (renames) files and directoriesls --color=auto06Creates directoriesls --color=auto09Displays manual page of other commandsls --color=auto13Creates empty filesls --color=auto17Changes file permissionsls --color=auto04Runs an executablels --color=auto27Exits the current shell sessionls --color=auto29Executes commands as superuserls --color=auto30Shutdowns your machinels --color=auto34Displays processes and resources informationls --color=auto36Extracts compressed ZIP filesls --color=auto37, ls --color=auto38, ls --color=auto39Package managersls --color=auto40Displays lines of textls --color=auto42Prints file contentsls --color=auto44Reports shell processes statusls --color=auto47Terminates programsls --color=auto51Tests network connectivityls --color=auto54Efficient text editingls --color=auto56Shows a list of previous commandsls --color=auto58Changes user passwordls --color=auto60Returns the full binary path of a programls --color=auto62Overwrites a file to hide its contentsls --color=auto66Inspects files interactivelyls --color=auto72Displays last lines of a filels --color=auto76Displays first lines of a filels --color=auto80Prints lines that match patternsls --color=auto82Outputs usernamels --color=auto85Shows single-line descriptionsls --color=auto87Word count filesls --color=auto89Displays OS informationls --color=auto92Displays OS and hardware informationls --color=auto93Searches for files that follow a patternls --color=auto95Retrieves files from the internet

 

As of 2020, Linux was the most-used operating system by professional developers 😲 Learn the 40 most-used commands and start taking advantage of this powerful system with this post🚀Click to Tweet

Summary

It can take some time to learn Linux, but once you master some of its tools, it becomes your best ally, and you won’t regret choosing it as your daily driver.

One of the remarkable things about Linux is that even if you’re an experienced user, you’ll never stop learning to be more productive using it.

There are a lot more helpful Linux commands. If we’ve left something out, please share your favorite Linux commands in the comments below!

Get all your applications, databases and WordPress sites online and under one roof. Our feature-packed, high-performance cloud platform includes:

  • Easy setup and management in the MyKinsta dashboard
  • 24/7 expert support
  • The best Google Cloud Platform hardware and network, powered by Kubernetes for maximum scalability
  • An enterprise-level Cloudflare integration for speed and security
  • Global audience reach with up to 35 data centers and 275+ PoPs worldwide

Test it yourself with $20 off your first month of Application Hosting or Database Hosting. Explore our plans or talk to sales to find your best fit.

Which of the following Linux commands utilities can be used to edit a wireless connection's configuration settings?

Which of the following Linux commands/utilities can be used to edit a wireless connection's configuration settings? C. There is a utility called ifconfig that is used to see and edit network configuration files. It has a counterpart, iwconfig, that works with wireless connection configuration files.

What are the utility commands in Linux?

Top 50 Linux Commands You Must Know as a Regular User..
The ls command in Linux..
The pwd command in Linux..
The cd command in Linux..
The mkdir command in Linux..
The cp and mv commands..
The rm command in Linux..
The touch command in Linux..

What is file utilities in Linux?

These are the Linux commands which help you to create, delete, rename, move, copy, edit and perform other related activities on Linux files.

Which of the following Linux commands can be used to create file?

The easiest way to create a new file in Linux is by using the touch command. The ls command lists the contents of the current directory. Since no other directory was specified, the touch command created the file in the current directory.

Chủ đề