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.

Show

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 Videos
7. 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.

Which of the following Linux commands utilities can be used to edit a file?
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 Videos
8) and double hyphens (
cd Videos
9), 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.”

Which of the following Linux commands utilities can be used to edit a file?
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/Videos
0 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/Videos
2 flag. This flag returns all the flags you can use with ls.

For example, to colorize the output of the

cd /home/kinsta/Documents/Videos
0 command, you can use the following:

ls --color=auto
Which of the following Linux commands utilities can be used to edit a file?
The colorized ls command.

Now the

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

But typing

cd /home/kinsta/Documents/Videos
0 with the color flag would be inefficient; that’s why we use the
cd /home/kinsta/Documents/Videos
6 command.

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

The

cd /home/kinsta/Documents/Videos
6 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/Videos
0 to have color without typing the
cd
0 flag every time, you would use:

alias ls="ls --color=auto"

As you can see, the

cd /home/kinsta/Documents/Videos
6 command takes one key-value pair parameter:
cd
2. 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/Videos
6 command without argument.

alias
Which of the following Linux commands utilities can be used to edit a file?
The alias command.

3. cd4 Command

As the name suggests, the

cd
4 command aims to remove an
cd /home/kinsta/Documents/Videos
6 from the already defined aliases. To remove the previous
cd /home/kinsta/Documents/Videos
0 alias, you can use:

unalias ls

4. cd8 Command

The

cd
8 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

cd
8 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/Videos
0. 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=auto
0

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=auto
1

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

ls --color=auto
2

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=auto
3

If you want to delete an empty directory, you can use the recursive (

ls --color=auto
01) flag:

ls --color=auto
4

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=auto
5

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=auto
02 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=auto
6

To utilize absolute paths, you’d use:

ls --color=auto
7

…where

ls --color=auto
04 is the directory you’re currently in.

You also can use

ls --color=auto
02 to rename files while keeping them in the same directory:

ls --color=auto
8

9. ls --color=auto06 Command

To create folders in the shell, you use the

ls --color=auto
06 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=auto
9

To create subdirectories with a simple command, use the parent (

ls --color=auto
08) flag:

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

10. ls --color=auto09 Command

Another essential Linux command is

ls --color=auto
09. It displays the manual page of any other command (as long as it has one).

To see the manual page of the

ls --color=auto
06 command, type:

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

You could even refer to the

ls --color=auto
09 manual page:

alias ls="ls --color=auto"
2
Which of the following Linux commands utilities can be used to edit a file?
The manual page of “man.”

11. ls --color=auto13 Command

The

ls --color=auto
13 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:

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

To change its modification date to the current time, we need to use the

ls --color=auto
15 flag:

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

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

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

Nonetheless, most of the time, you won’t use

ls --color=auto
13 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=auto
17 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=auto
17 is to make a file executable by the user. To do this, type
ls --color=auto
17 and the flag
ls --color=auto
21, 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=auto
04 notation.

13. ls --color=auto04 Command

Maybe the

ls --color=auto
04 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=auto
17 command.

Here’s a simple Python script and how we would run it with the

ls --color=auto
04 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=auto
27 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=auto
30 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:

alias
0

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

alias
1

To cancel a previous

ls --color=auto
30 call, you can use the
ls --color=auto
33 flag:

alias
2

17. ls --color=auto34 Command

ls --color=auto
34 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

alias
3
Which of the following Linux commands utilities can be used to edit a file?
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:

alias
4

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)

alias
5

2. Red Hat-based (Fedora, CentOS)

alias
6

3. Arch-based (Manjaro, Arco Linux)

alias
7

20. ls --color=auto40 Command

The

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

alias
8
Which of the following Linux commands utilities can be used to edit a file?
The echo command

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

alias
9

21. ls --color=auto42 Command

ls --color=auto
43, 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 ls
0
Which of the following Linux commands utilities can be used to edit a file?
The cat command.

22. ls --color=auto44 Command

With

ls --color=auto
44, 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 ls
1
Which of the following Linux commands utilities can be used to edit a file?
The ps command.

In case you want something more interactive, you can use

ls --color=auto
34.

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=auto
47 command solves this kind of problem.

Simply put,

ls --color=auto
47 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 ls
2

Be careful with this command — with

ls --color=auto
47, you run the risk of accidentally deleting the work you’ve been doing.

24. ls --color=auto51 Command

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

unalias ls
3

25. ls --color=auto54 Command

ls --color=auto
54 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 ls
4
Which of the following Linux commands utilities can be used to edit a file?
The vim text editor.

26. ls --color=auto56 Command

If you’re struggling to remember a command,

ls --color=auto
56 comes in handy. This command displays an enumerated list with the commands you’ve used in the past:

unalias ls
5
Which of the following Linux commands utilities can be used to edit a file?
The history command.

27. ls --color=auto58 Command

ls --color=auto
58 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 ls
6
Which of the following Linux commands utilities can be used to edit a file?
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=auto
60 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 ls
7

29. ls --color=auto62 Command

If you ever wanted a file to be almost impossible to recover,

ls --color=auto
62 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:

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

Now, let’s have

ls --color=auto
62 do its thing by typing the following command:

unalias ls
8
Which of the following Linux commands utilities can be used to edit a file?
Overwritten content.

If you want to delete the file right away, you can use the

ls --color=auto
65 flag:

unalias ls
9

30. ls --color=auto66 Command

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

pwd

# My result: /home/kinsta/Documents/linux-commands
0
Which of the following Linux commands utilities can be used to edit a file?
The less command.

The neat thing about

ls --color=auto
66 is that it includes more and
ls --color=auto
54 commands in its interface. If you need something more interactive than
ls --color=auto
42,
ls --color=auto
66 is a good option.

31. ls --color=auto72 Command

Similar to

ls --color=auto
42,
ls --color=auto
72 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=auto
75.

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

pwd

# My result: /home/kinsta/Documents/linux-commands
1
Which of the following Linux commands utilities can be used to edit a file?
The tail command.

To view only the last four lines:

pwd

# My result: /home/kinsta/Documents/linux-commands
2
Which of the following Linux commands utilities can be used to edit a file?
tail four lines.

32. ls --color=auto76 Command

This one is complementary to the

ls --color=auto
72 command.
ls --color=auto
76 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=auto
75 flag:

pwd

# My result: /home/kinsta/Documents/linux-commands
3
Which of the following Linux commands utilities can be used to edit a file?
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-commands
4
Which of the following Linux commands utilities can be used to edit a file?
The grep command.

You can count the number of times the pattern repeats by using the

ls --color=auto
33 flag:

pwd

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

34. ls --color=auto82 Command

The

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

pwd

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

You would get the same result by using

ls --color=auto
40 and the environmental variable $USER:

pwd

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

35. ls --color=auto85 Command

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

pwd

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

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-commands
9

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=auto
88 flag:

cd Videos
0

37. ls --color=auto89 Command

ls --color=auto
89(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=auto
91 (–all) flag, since the default output isn’t that useful:

cd Videos
1

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 Videos
2
Which of the following Linux commands utilities can be used to edit a file?
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=auto
93 command searches for files in a directory hierarchy based on a regex expression. To use it, follow the syntax below:

cd Videos
3

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

cd Videos
4

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

cd Videos
5

40. ls --color=auto95 Command

ls --color=auto
95 (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 Videos
6

Linux Commands Cheat Sheet

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

CommandUsage
cd /home/kinsta/Documents/Videos
0Lists the content of a directory
cd /home/kinsta/Documents/Videos
6Define or display aliases
cd
4Remove
cd /home/kinsta/Documents/Videos
6 definitions
cd
8Prints the working directory
cd ..
2Changes directory
cd ..
6Copies files and directories
cd ..
9Remove files and directories
ls --color=auto
02Moves (renames) files and directories
ls --color=auto
06Creates directories
ls --color=auto
09Displays manual page of other commands
ls --color=auto
13Creates empty files
ls --color=auto
17Changes file permissions
ls --color=auto
04Runs an executable
ls --color=auto
27Exits the current shell session
ls --color=auto
29Executes commands as superuser
ls --color=auto
30Shutdowns your machine
ls --color=auto
34Displays processes and resources information
ls --color=auto
36Extracts compressed ZIP files
ls --color=auto
37,
ls --color=auto
38,
ls --color=auto
39Package managers
ls --color=auto
40Displays lines of text
ls --color=auto
42Prints file contents
ls --color=auto
44Reports shell processes status
ls --color=auto
47Terminates programs
ls --color=auto
51Tests network connectivity
ls --color=auto
54Efficient text editing
ls --color=auto
56Shows a list of previous commands
ls --color=auto
58Changes user password
ls --color=auto
60Returns the full binary path of a program
ls --color=auto
62Overwrites a file to hide its contents
ls --color=auto
66Inspects files interactively
ls --color=auto
72Displays last lines of a file
ls --color=auto
76Displays first lines of a file
ls --color=auto
80Prints lines that match patterns
ls --color=auto
82Outputs username
ls --color=auto
85Shows single-line descriptions
ls --color=auto
87Word count files
ls --color=auto
89Displays OS information
ls --color=auto
92Displays OS and hardware information
ls --color=auto
93Searches for files that follow a pattern
ls --color=auto
95Retrieves 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.