How to Use Disown Command in Linux?

Photo of author

By admin

Linux is a group of open-source Unix-like structures based on Linus Torvalds’ Linux Kernel, which was originally published on September 17, 1991. A Linux distribution is typically a collection of Linux packages. The disown command is used to eliminate tasks from the current shell in the Unix ksh, bash, and zsh shells. It’s a shell built-in command, similar to cd or pwd, and it doesn’t need root capabilities. This article will show you how to use the disown command in Linux to both stop and retain ongoing processes after you log out along with the basics of Linux. Keep reading this article to know more!

Structure of the Linux Operating System

An operating system is a suite of software programs, each of which is built to perform a certain task.

The elements of the Linux operating system are as follows:

1. Kernel:

The Linux Kernel is the most important component of the operating system. It enables gadgets and apps to interact with one another. It also looks after the system’s resources. It is in charge of four things:

2. Device Management:

Several devices are linked to a system, including the CPU, RAM, sound cards, graphic cards, and so forth. In the device driver, a Kernel contains all of the data linked to all of the gadgets (without this Kernel, you won’t be able to operate the devices).

3. Memory Management:

Memory management is yet another job that the Kernel is responsible for. The Kernel maintains an account of how much memory is in use and ensures that programs don’t modify each other’s data by utilizing virtual memory locations.

4. Process Management:

Before allocating CPU to other processes, the management Kernel allocates sufficient time and gives priority to processes. It also addresses issues of security and ownership.

5. Handling System Calls:

A developer can use system calls to submit an inquiry or urge the Kernel to do a job.

6. System Libraries:

System libraries are specialized applications that aid in the use of kernel functionality. To complete a job, a kernel must be triggered, and this prompting is handled by the apps. However, since each kernel has its own set of system calls, programs must understand how to utilize them.

To interface with the kernel, developers have created a standard library of operations. These protocols are supported by each operating system, and they are then converted to system calls for that operating system.

Glibc is a very well-known Linux system library (GNU C library).

7. System Tools:

The Linux operating system includes several utility tools, most of which are simple commands. It is a piece of software that the GNU project has created and released under an open-source license, making it available for free to everybody.

You can browse your data, modify and alter data in your folders or files, change the placement of files, and so on using commands.

8. Development Tools:

Your operating system is up and running with the three elements listed above. However, you have extra tools and libraries to upgrade your system. The term “toolchain” refers to a collection of additional tools and libraries built by developers.

A toolchain is a crucial development tool that programmers utilize to create a functional program.

9. End-User Tools:

These end devices enable a system distinctive for a user. Although end tools are not necessary by the operating system, they are needed by the user.

Graphic design software, office suites, browsers, multimedia players, and other end products are some instances.

How does Linux Work?

Linux was designed to be a UNIX-like operating system, but it has since evolved to run on a wide range of hardware, including phones and quantum computers. The Linux kernel, which handles hardware, is included in every Linux-based OS, and also a library of software packages that make up the remainder of the operating system.

Some popular basic elements like the GNU tools, for example, are included in the operating system. These programs allow the user to administer the kernel’s capabilities, install extra software, adjust reliability and scalability settings, and much more.

The operating system is made up of each of these tools when they are combined. Various Linux distributions may contain several software bundles because Linux is an open-source operating system.

Additionally, the Linux operating system provides several fundamental GNU utilities for managing kernel resources, installing applications, configuring security settings and performance, and much more. All of these technologies are used to form a working operating system.

How to Use Linux?

We can use Linux from both an interactive UI and a terminal (Command Line Interface). Various distributions have slightly different user interfaces, but nearly all commands function the same way across all of them.

Press the ‘Ctrl’ + ‘Alt’ + ‘T’ keys to start Linux via the terminal. And, to learn more about it, hit the program button in the lower-left corner of the screen.

What is a Command-Line?

The command line is your direct channel of communication with a computer. It’s where you tell the program to do things that point-and-click graphical user interfaces can’t.

Many operating systems, both commercial and open-source, have command lines. However, it’s most commonly linked with Linux since both command lines and open source software allow users to have complete control over their computers.

How to Use Disown Command in Linux?

There is a common question amongst individuals using Linux. And the solution to this is surprisingly simple.

So, Job control is defined as the capacity to halt/suspend the implementation of processes (commands) and resume/continue their execution as needed. Your OS and shell, like bash/ksh or POSIX shell, are used to do this.

To restart a halted background process, use the bg command. In the current shell environment, the fg command brings a backend job to the forefront. Use the disown command to delete/remove jobs or tell the shell not to issue a HUP signal. This command may be found in the bash or ksh93 shells.

Let’s go into it in a detailed manner:

There are some obvious prerequisites before you go ahead with the execution to disown command in Linux. One is an active system using Linux and the other being the accessibility to a command line.

The primary syntax for the disown command is:

disown [options] jobID1 jobID2 … jobIDN

Now, let’s see how to execute the disown Command in Linux:

To delete jobs from the job table in Linux, use the disown command. It may also be used to keep a longer, more complicated task operating in the background while you log off of the server.

You must have jobs running on your system before you use the disown command.

We’ll set up a few jobs in the background in this instance:

cat /dev/random > /dev/null &

ping google.com > /dev/null &

To get a list of all active jobs, use the following jobs command:

jobs -l

The active command will be represented by a ‘+’. The command that is preceded by a ‘‘ indicates that if the active command is terminated, it will take over as the current task.

Run the below command to delete all jobs from the job table:

disown -a

Use the disown command with the relevant job ID to delete a particular job from the job database. On the job table, the job ID is shown in brackets. If you want to, for example, remove the third job, the command will be:

disown %3

The final job on the job table is removed when you use the disown command without any variables or job IDs.

In addition, job IDs always begin with the percent symbol. Use %n to choose a particular job from the table, where n is the job number. The presently active job is selected when %% is used.

Use the following command to delete just the jobs that are presently running:

disown -r

All presently running jobs are immediately stopped when you quit your system’s terminal. Use the disown command with the -h argument to avoid this:

disown -h jobID

Close the terminal after using the disown command by running the following command:

exit

Any tasks on which you used the disown -h command will continue to execute.

Conclusion

You should be able to use the disown command to delete jobs from the job list or keep them running even after closing the terminal window after finishing these instructions. This article also gave you an in-depth perspective of Linux.

We hope you found this article interesting. Continue to spread the word by sharing your newfound knowledge with your friends and colleagues.

Leave a Comment