Trending December 2023 # How To Use The Ps Command In Linux To Kill Process # Suggested January 2024 # Top 12 Popular

You are reading the article How To Use The Ps Command In Linux To Kill Process updated in December 2023 on the website Kientrucdochoi.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested January 2024 How To Use The Ps Command In Linux To Kill Process

When you are working, sometimes your programs suddenly freeze. Other times, the programs are still running but with a high processor or memory consumption. There is a way to fix this in Linux using the ps (Process Status) command. Here we show you how to use the ps command in Linux to list the currently running processes and their PIDs. You can then find and kill the processes consuming your resources.

Using the “ps” command

The ps command can be used on its own. It will output four columns of information:

PID: the unique identifier of the process defined by the system. It’s the value that we use to stop a process.

TTY: terminal from which the process was started.

TIME: the total amount of CPU time used by the process.

CMD: command that generates the process

Note that when you use the command without any options, it doesn’t show you much information. Here are a few ways to make it more useful.

1. List the process of all users

When some programs are installed, they sometimes also create some additional users to run the process. To list the processes of the users, use the -e option:

ps

-e

and its output:

PID TTY TIME CMD

1

? 00:00:02 systemd

2

? 00:00:00 kthreadd

3

? 00:00:00 kworker

/

0

:

0

4

? 00:00:00 kworker

/

0

:0H

5

? 00:00:00 kworker

/

u256:

0

6

? 00:00:00 mm_percpu_wq 2. List process with more information

It’s possible to have more information when you list the running process. To do this, you can use the ef option.

ps

-ef

and its output:

UID PID PPID C STIME TTY TIME CMD root

1

0

0

21

:

34

? 00:00:03

/

sbin

/

init maybe-ubiquity root

2

0

0

21

:

34

? 00:00:00

[

kthreadd

]

root

3

2

0

21

:

34

? 00:00:00

[

kworker

/

0

:

0

]

root

4

2

0

21

:

34

? 00:00:00

[

kworker

/

0

:0H

]

root

6

2

0

21

:

34

? 00:00:00

[

mm_percpu_wq

]

root

7

2

0

21

:

34

? 00:00:00

[

ksoftirqd

/

0

]

3. Filter the Process by Process ID

If you know the process ID of the running process you want to show, you can filter for it specifically with the -p flag. This can take multiple PIDs as arguments, separated by a single comma and no space.

ps

-ef

-p

1234

,

5678

,

9012

4. List the processes owned by a user

You can also list the processes that are owned by a user with the u option followed by the name of the user:

ps

-u

userName

and its output:

PID TTY TIME CMD

2832

? 00:00:00 systemd

2842

? 00:00:00

(

sd-pam

)

3043

? 00:00:00 sshd

3044

pts

/

1

00:00:00

bash

18396

pts

/

1

00:00:00

ps

5. List the actives processes

It’s possible to list all the processes that are active by using the ax option:

ps

-ax

and its output:

PID TTY STAT TIME COMMAND

1

? Ss

0

:02

/

sbin

/

init maybe-ubiquity

2

? S

0

:00

[

kthreadd

]

3

? I

0

:00

[

kworker

/

0

:

0

]

4

? I

<

0

:00

[

kworker

/

0

:0H

]

6

? I

<

0

:00

[

mm_percpu_wq

]

7

? S

0

:00

[

ksoftirqd

/

0

]

6. List the active processes with the users

It’s possible to list all the active processes with the users when you add the -aux flag:

ps

-aux

and its output:

USER PID

%

CPU

%

MEM VSZ RSS TTY STAT START TIME COMMAND root

1

0.0

0.2

78132

9188

? Ss

21

:

34

0

:02

/

sbin

/

init maybe-ubiquity root

2

0.0

0.0

0

0

? S

21

:

34

0

:00

[

kthreadd

]

root

3

0.0

0.0

0

0

? I

21

:

34

0

:00

[

kworker

/

0

:

0

]

root

4

0.0

0.0

0

0

? I

<

21

:

34

0

:00

[

kworker

/

0

:0H

]

root

6

0.0

0.0

0

0

? I

<

21

:

34

0

:00

[

mm_percpu_wq

]

root

7

0.0

0.0

0

0

? S

21

:

34

0

:00

[

ksoftirqd

/

0

]

root

8

0.0

0.0

0

0

? I

21

:

34

0

:00

[

rcu_sched

]

root

9

0.0

0.0

0

0

? I

21

:

34

0

:00

[

rcu_bh

]

root

10

0.0

0.0

0

0

? S

21

:

34

0

:00

[

migration

/

0

]

7. Filter the process by the name of a program

It’s possible to retrieve the information about a specific program that is running by applying a filter on the ps result:

root

1508

0.0

2.2

1518156

90868

? Ssl

21

:

34

0

:03

/

usr

/

bin

/

dockerd

-H

fd:

//

--containerd

=

/

run

/

containerd

/

containerd.sock userkub+

18429

0.0

0.0

13144

1108

pts

/

1

S+

23

:

57

0

:00

grep

--color

=auto docker

Alternatively, you can also use the C option to filter the process by its name:

ps

-C

name 8. Display Specific Columns

In addition to the four default columns, you can get ps to display an additional column of information. For example:

ps

-e

-o

pid,

uname

,pcpu,pmem,

comm

The -o flag sets specific output display options for the ps command’s results. See a full list of standard display options for ps.

9. Display Results in Hierarchical Tree Style

ps

-e

--forest

This uses ASCII art to create a tree-style structure for displaying processes. Shows forked and children processes as descendants of the appropriate parent processes, sorting to match. To hide the “branches” of the tree, use -H in place of --forest.

11. Show All Root Processes

ps

-f

-U

root

-u

root

Execute a search for all processes running with real and effective root identifications. This shows them in the full-length format, thanks to the -f flag. You can combine it with the -o flag to customize output.

Use the kill command to stop a process

Once you have located the misbehaving process, you can use the kill command to kill a process that is running. The command sends a signal to a process that terminates it. When your programs are frozen, most of the time you will need to forcefully kill them with the -9 option.

The output of ps is an instant view. Unlike htop, It does not update itself dynamically. This means you might have to run it multiple times to get a clear picture of which process is misbehaving. To get an up-to-date view of the processes, you can try some other commands for the Linux system.

Alain Francois

A Linux system administrator passionate about Open-Source environments and working on installations, deployments for different IT solutions and cloud environments. I like to share my knowledge regarding the technologies that I can discover and use

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.

By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.

You're reading How To Use The Ps Command In Linux To Kill Process

How To Use The Zip Command In Linux To Compress Files And Folders

The zip command in Linux is probably the simplest and most intuitive way to work with ZIP files on the command line. And not just that, the ZIP file format is universal – almost every OS out there has a native program that can work with it. Here’s all the ways you can use this command in any Linux command line.

How to Install Zip in Linux

The latest version of the Linux zip command should be available in all major package managers.

For Debian/Ubuntu:

sudo

apt

install

zip

For Arch Linux:

sudo

pacman

-S

zip

For Fedora:

sudo

dnf

install

zip

For Gentoo

sudo

emerge

--ask

zip

Note: Before installing anything, make sure to update your package manager first to get the zip command’s latest version. You can learn how to do that and more with our Linux package manager cheatsheet.

Note: With zip installed, the unzip command will also be available now.

Zip Command in Linux: Syntax and Options

There’s a basic syntax to the zip command, and it takes just two parameters: the output ZIP file’s filename and the input’s filename.

As for setting the options, you’ll need to work with flags. There are 8 flags you would regularly need for normal use:

-d delete selected archived entries in the ZIP file.

-q quietly do task without printing anything on the terminal.

-T test the ZIP file’s integrity.

-e encrypt file.

-u update ZIP file by adding new files into the archive.

-m move file into archive.

-r recursively add files within a folder into a ZIP file.

-x exclude files with the selected filenames.

-i include only files with the selected names.

You can place the flags anywhere you like whether they’re before the output, after the input, between the two – you can even use multiple flags scattered all around the line in any order. Just make sure that you type them after typing zip.

The exception are -x and -i which need a new input after using them.

How to Zip a File in Linux Using the Zip Command

The easiest way to archive files with the zip command is to type zip followed by the filename of the ZIP file and then the file you are trying to archive or compress. Flags are optional, so you can do it like that to quickly zip any file on Linux.

zip

chúng tôi text_file.txt

You can also add more files by adding the others after the first file you were trying to archive. And if any of these have spaces in their names, you can enclose them in quotation marks.

zip

chúng tôi

"file 1.txt"

"file 2.txt"

"file 3.txt"

"file 4.txt"

Using the -d Flag

The -d flag lets you delete a file archived within the ZIP file in the same way you would have added it into one.

zip

-d

chúng tôi remove_me.jpg

You can also use it to remove entire folders within the archive. However, this won’t work for files outside of the ZIP file (so you can’t use it to delete files after archiving).

Using the -q Flag

The -q flag is for making sure that zip won’t return a message when it does its thing.

zip

-q

chúng tôi text_file.txt

It’s useful when you’re using the zip command with a script. But if you’re using this by yourself, you might want to avoid using the -q flag since you won’t know if the the archiving process was successful without checking with the dir or ls command.

Using the -T Flag

Some files Some ZIP files can get corrupted during download – it happens. You can use the -T flag to check the integrity so you would know if it really is a broken file or you’re just inputting the wrong password.

zip

-T

chúng tôi is pretty important when downloading large files like OS images. For files like these, you can successfully burn them into a live USB and end up with errors once you run the image file on your machine. The same goes with videos and music that get cut-up parts in random places.

Using the -u Flag

If you wanted to add a new file into an existing ZIP file, you can use the -u flag.

zip

-u

chúng tôi new_file.txt

You can also add more files by adding them after the first file, as if you were using the zip command normally to make a new ZIP archive.

Using the -e Flag

If you want to add a password, you need to use the -e flag. This option only applies the password and encryption into the file you add into the ZIP file within its command, so previous files will remain unencrypted if you use this with the -u flag.

zip

-e

chúng tôi text_file.txt

The great thing about ZIP files is that the password-making process also adds an extra layer of protection besides giving access. Your password works like a digital signature which is used to decrypt an extra encryption layer added into the ZIP file.

Using the -m Flag

Lastly, the -m flag deletes the original file after it gets archived into the ZIP file. Think of this as automating an extra step so you won’t have to remove it by yourself.

zip

-m

chúng tôi text_file.txt

One important bit to remember though: the -m flag deletes files in such a way that makes it impossible to recover them without using a file restoration tool. So be sure to keep a backup, or just remove things manually using the rm command instead.

How to Zip a Folder in Linux Using the Zip Command

If you use the zip command on a raw folder, you’ll be left with a folder that does not contain any files at all. Whenever you are trying to zip a folder, you need to use the -r flag.

Using the -r Flag

The -r flag, aka recursive, goes through each content of a folder and its subfolders and archives every single one into the ZIP file. It will also retain the current structure of each subfolder.

zip

-r

chúng tôi my_folder

This also works if you want to archive everything within the current folder. Just replace my_folder with ./ and it will change its target to everything within the current one.

zip

-r

chúng tôi .

/

Furthermore, you can use this alongside the -u flag to include folders and their contents into an existing ZIP file.

zip

-r

-u

chúng tôi another_folder Using the -i Flag

The -i flag lets you pick out a specific file that you want to include and excludes everything else within a folder

zip

-r

chúng tôi my_folder

-i

my_folder

/

a_subfolder

/

file1.txt

By using * asterisks with the -i flag, you can select files that share similar names but could end with something like a number. For example, typing *.txt will make the zip command include all TXT files within the folder.

zip

-r

chúng tôi my_folder

-i

"*.txt"

Using the -x Flag

The -x flag lets you exclude only certain files while zipping a whole folder.

zip

-r

chúng tôi my_folder

-x

my_folder

/

dont_zip.jpg

Also, the -x flag overrides the -i flag when used together. This way, you can, for example, tell zip to include all the other files of the same type except for the file you don’t want it to zip.

zip

-r

chúng tôi my_folder

-i

"*.txt"

-x

my_folder

/

dont_zip.txt How to Unzip a File Using the Linux Zip Command

The unzip program is a partner program to the default zip program. It extracts files from your ZIP archive.

To use this program, you just need to type unzip and the filename of the ZIP archive.

unzip

chúng tôi using the unzip command, you will unzip the ZIP file within the current working directory regardless of where the ZIP file came from.

To extract or unzip a Linux file within a ZIP file so the others remain unextracted, you can add its filename after the part where you type the archive.

unzip

chúng tôi chúng tôi to Unzip a Linux Folder With Zip

While unzip will normally extract folders located within a ZIP archive, it can be pretty hard to make it extract only certain folders. But that does not mean it’s impossible.

unzip

chúng tôi my_folder

/

a_subfolder

/*

That line of code extracts everything within a_subfolder.

Also, when you unzip a folder, the unzip program creates a new folder within the current working directory and unpacks its folders there. If a folder exists with the same name (or a previous version of the folder is present), it ask if it’s okay to replace the file that’s currently in the folder.

Frequently Asked Questions What does the gzip command in Linux do?

The Linux gzip command is a tool that you can use to store and compress files into a GZ file.

Is ZIP better than TAR?

In a way, ZIP is better than TAR because ZIP files can compress, encrypt, and protect their contents. However, TAR files are meant to combine files into one file for faster file transfer while ZIP files (despite being used for the same purpose) come with those extra features in mind.

Is TAR faster than ZIP?

TAR files do not compress nor encrypt their contents. So if you are looking for a faster way to combine a large amount of files into a single easy-to-transfer archive, you’ll see some gains with TAR compared to ZIP. However, you might find it easier to transfer a ZIP file instead of a TAR file because ZIP files tend to be much smaller than TAR files.

Image credit: Unsplash, Screenshots by Terenz Jomar Dela Cruz

Terenz Jomar Dela Cruz

Terenz is a hobbyist roboticist trying to build the most awesome robot the world has ever seen. He could have done that already if he wasn't so busy burning through LEDs as a second hobby.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.

By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.

How To Use Nano Command Line Text Editor In Linux

Nano is a simple yet powerful command line-based text editor, very popular among beginner Linux users for its simple-to-use interface. As a command-line editor, it offers a lightweight alternative to more complex graphical text editors. In this article, we will explain how you can use the nano text editor in Linux, right from installing it to editing documents with it.

How to Install Nano in Linux

Generally, the nano editor comes preinstalled on most Linux distros. If you are not sure, you can check using the following command:

nano --version

After executing the command, if you see the nano version number in the Linux Terminal, this means it is installed, and you can proceed to the next section wherein we’ve described how to use the nano editor in Linux. If you get an error like “nano: command not found,” then use the commands below to install nano depending on your distro:

For Debian-based distros:

Install on Cent OS/RHEL-based distro:

sudo yum install -y nano

For Arch-based distros:

sudo pacman -S nano

For Fedora-based distros:

sudo dnf install nano

Nano Command: Syntax and Options

Using the nano command line editor in Linux is pretty straightforward. The basic syntax to use nano text editor is:

OptionsDescription-BTo save a file and back up the previous version of it by appending a tilde (~) to the current filename.-ETo convert the typed tabs into spaces.-LTo stop adding a new line after the original text.-NDisables automatic conversion of files from Mac/DOS format to Unix format-QTo match a part of the text using regular expressions-lDisplays the line number to the left of the text area-uTo save the file in Unix format by default.

How to Open/ Create a New File with Nano

To open a file with the nano command in Linux, use this syntax:

For example, to open the file “test.txt”, use the following command:

nano test.txt

For example, to create a new file with the name “test.py”, use this command:

nano test1.txt

When the nano command is executed, it first looks for the given file name in the mentioned directory. If the file is found, it opens the file, else creates a new file with the given file name.

How to Edit a File with the Nano Editor Cut Selected Text

To select the text, head over to the beginning of the word which you want to select and press “ALT + A.” Use the arrow keys to select the text as you need.

Once you have selected the desired text, press “CTRL + K” on the keyboard to cut the selected portion of the text.

Copy Selected Text

First, select the text using “ALT + A” and the arrow keys.

Once selected, use “ALT + 6” to copy the selected text to the clipboard.

Paste Selected Text

First, navigate to the place where you want to paste the selected text using the arrow keys.

Now, press “CTRL + U” on the keyboard to paste the text from the clipboard.

Search and Replace Text in Nano

Sometimes you need to search for some specific text inside a huge document and scrolling through it is not a viable option. Fortunately, the nano command comes with a search-and-replace utility, which can work on documents formatted with Linux, Windows, macOS, etc.

To search for a specific text, press “CTRL + W,” type the text you want to search in the new search bar at the bottom of the screen and hit the Enter key. If found, the cursor will get placed at the beginning of the searched word. To move on to the next occurrence of the searched term, use “ALT + W.”

To search and replace a specific text, press “CTRL + ” on the keyboard. Enter the search term and press enter. Then, enter the term you want to replace it with on the next prompt. The cursor will move to the first position it found the search term.

You can press either ‘y’ to replace this text or ‘n’ to skip the current match and move on to the next one.

The default nano command keybindings are different from the common keybindings, which the users may be accustomed to while working on other Linux GUI apps. To make things easier for beginners, the Nano text editor has a small cheat sheet right at the bottom of the screen (more on it later).

How to Save Files and Exit Nano Editor

How to exit Vim is a question that has been wreaking havoc in the lives of Linux users since its inception, as you don’t get any prompt even for basic tasks such as saving or exiting the editor. However, the nano command provides a small prompt to help users get around.

To save and exit the nano command screen and return back to the Linux shell prompt, simply press “CTRL + X” on your keyboard. If you have made any changes to the file, press ‘y’ to save the changes or press ‘n’ to discard them. You will then be asked if you want to keep the same file name or use a new name. Enter the new file name or press Enter to use the same file name.

To simply save and continue editing the document in Nano editor, press “CTRL + O” on the keyboard. Press the Enter key to use the same file name or enter the new name and then hit enter.

Nano Command in Linux: Keyboard Shortcuts

Here are some of the common shortcuts to use with the nano command that works on all operating systems, including Linux, Windows, macOS, etc:

Keyboard ShortcutDescriptionCTRL + AMoves the cursor at the beginning of the lineCTRL + EMoves the cursor at the end of the lineCTRL + YScrolls the screen up by a pageCTRL + VScrolls the screen down by a pageCTRL + GOpens nano command help windowCTRL + OSaves the current fileCTRL + WSearches for a specific text in the entire documentCTRL + KCuts the entire selected portion of text to the clipboardCTRL + UPastes the text portion from the clipboard into the documentALT + 6Copies the selected text to the clipboardCTRL + XExits the editorCTRL + _Lets you go to the specified line and column chúng tôi + AUsed to select textCTRL + GOpen help menu for nano

Frequently Asked Questions

Why do we use nano in Linux?

The nano editor is a simple easy-to-use command-line text editor, which can be handy for editing text documents on Linux distros.

Is nano easy to use?

Compared to Vim, the nano command line editor in Linux has a much easier learning curve and is easy for beginners to use in their daily workflow.

How To Kill A Process In Windows 10

Whether you’re dealing with a slow computer or just noticed a bunch of bloatware hogging all resources, killing the offending processes in Windows is the best method to deal with the problem.

Not only does this boost the performance of your PC, but it can also help stave off spyware and viruses. And before you ask: no, it’s not hard to kill a process in Windows 10. We’ll go over all the different ways you can do this safely and easily.

Table of Contents

Why Kill a Process in Windows 10?

Each running application in Windows is composed of one or more “processes.” These processes are responsible for writing things to memory, reacting to user input, and performing all the actual work behind a computer program.

The thing is, not all processes are represented by an active window on your desktop. Windows system processes, for example, run quietly in the background without any explicit permission from the user.

And this is where the problem arises. Many unwanted applications like viruses or bloatware also run as hidden processes in the background, consuming resources and slowing down your computer. You can safely shut down even some Windows processes without impacting your computer.

Killing Unnecessary Processes With the Task Manager

Its only drawback is its limited permissions. The Task Manager cannot kill protected processes (including system tasks and some viruses). In addition, it can be tedious to manually select and terminate all the target processes each time you run your computer.

By default, Task Manager opens in a streamlined view that displays only the names of the running apps themselves. Select More details to see all the processes.

Now you can see all the tasks running on your computer. They are split into the visible Apps and the invisible Background processes. You can see the CPU, Memory, Disk, and Network usage of each process on the right. Select any of the categories to sort the processes by resource usage.

Look for the processes unrelated to any running app or useful services, and select them.

You can also switch to the Details tab to get a more detailed overview of the processes. By looking at the User name, you can quickly identify which processes belong to the system.

In either of these tabs, select the End task button at the bottom right to kill the process. The task will be terminated and disappear from the list.

Using Command Prompt to Kill a Process in Windows

If you prefer command-line tools, then you can kill a process using CMD too. The Command Prompt gives access to many useful utilities, including one called Taskkill.

As the name suggests, you can use Taskkill to kill any running task or process. If you run CMD as an administrator, you can even kill protected tasks.

Before you can use Taskkill, you need to know either the name or PID of the task in question. Enter tasklist to get a list of all the running processes on your computer.

Now, you can use the Taskkill command in two ways. To use the PID, type taskkill /F /PID x, where x is the PID of the process you want to kill. You’ll be notified if the operation is successful.

If you want to enter the name instead, use taskkill /IM “x” /F, where x is the name of the process in question.

It may seem counter-intuitive to use a command-line tool when the Task Manager can do the same without any need for typed commands. This is because we have only touched upon the most basic way to use Taskkill. There are many other ways to filter the processes without having to look through them manually.

PowerShell

CMD is not the only method to kill Windows processes with typed commands. Powershell is Windows’ built-in scripting language that offers many similar capabilities. In a way, Powershell is just a more verbose form of the Command Prompt.

The power of Powershell comes from its ability to create scripts of commands, which Windows can execute at leisure. This allows you to automate complex tasks on Windows.

The PowerShell window will open up. It looks remarkably similar to the Command Prompt, just with a different background color.

Enter Get-Process to obtain a list of all the running processes on your computer.

To end a process, you can use either the PID or the name. For example, type Stop-Process -ID x -Force, where x is the PID to end any process.

Using the command does not produce any acknowledgment from the program, making it seem that nothing has happened. But that is its normal behavior for a successful operation. If you enter the wrong name, for example, you get an error message.

Use the command Stop-Process -Name “x” -Force, where x is the name of the process, to kill the process. This time, the command is successful.

If PowerShell seems underwhelming to you, it’s because we are using it like cmd. PowerShell is meant to create autonomous scripts that perform complex tasks independently, without any real-time feedback or input. While you can use it this way, the Command Prompt is frankly better at it.

Using KillProcess

So far, we have looked at tools and utilities present in your computer by default. While these certainly can get the job done, they lack some useful features present in third-party tools.

To begin, download KillProcess from the official website. There is both an installer and a portable version that you can use without any installation.

Upon running the app, you will be greeted with a task manager-like window. All the running processes on your computer are displayed in a list, along with their descriptions and memory usage.

The best thing about this approach is that you don’t have to kill each process one by one. This Kill List remains saved even after you exit the program, so you only need to run KillProcess itself to terminate all unwanted processes at once.

Many Ways to Kill a Process in Windows 10

There are multiple ways to kill a process in Windows 10. The most straightforward method is to use the Task Manager. It allows you to view and terminate processes in an easy-to-understand GUI format.

In case the Task Manager cannot kill the process, you need to use something more powerful. You can either try a third-party tool like KillProcess or use command-line tools to kill the protected process.

How To Use Hatch Command In Autocad?

Introduction to Hatch AutoCAD

Auto Cad is 2d and 3d computer-aided designing software, which Autodesk developed as designing software of engineering drawing. We have different types of 2d and 3d commands in this software to make drawing work easy for its users. Hatch is one of those commands. You can define Hatch as a command through which you can highlight a cross-section of a particular part of any component or apply the pattern in your drawing to specify a particular object. Here in this article, we will discuss the Hatch command of auto cad and analyze important parameters of it so that we can better understand this command.

How to Use Hatch Command in AutoCAD?

We can use Hatch in AutoCAD in few simple steps; you just have to follow the instructions of this article for using this command in your drawing, but before starting, let us have a look at the working screen of this software so that there will be no problem occurs during our learning of this topic.

Start Your Free Design Course

3D animation, modelling, simulation, game development & others

Step 1: At the top of the working screen, there is the ribbon in which we have many different types of tabs such as Home tab, Annotation tab, View tab and some others for managing different command in this software, below this we have a working window in which we can see our current working, below this working window there is some navigation command for handling our work during the making of the drawing.

Step 2: Now, let us have a drawing for applying hatch on it. I take a front view and top view of an engineering component like this. I want to show the cross-section of this component, so I will use a hatch for this purpose.

Step 4: Once you take the hatch command, the Hatch creation tab will be open at the command section of this software. Choose the pattern of the hatch which you want to apply on your object from the Pattern tab of the Hatch Creation tab.

Step 9: There is a difference between both methods when you use the Select method; then it will cover all portion which is inside the boundary of your selected object.

Step 10: But if you go with the Pick Point method, it will only apply a hatch on the selected object and leave the object inside your selected object. So you can take any method according to your requirement.

Step 11: You can apply more than one pattern of the hatch on different objects. To apply two different hatch patterns, apply the first pattern on the first object by the same method as we did in previous, then exit from command and again go to hatch command, then apply different hatch patterns on another object.

Step 14: If you want to increase the density of the hatch, then increase the scale of the hatch. You can increase the scale from this option. For example, I increase the value to 2 after selecting my hatch.

Step 15: Then, the size of my hatch block will increase like this.

Step 16: You can also change the angle of your hatch pattern. For changing the angle, select your hatch and enter the value of hatch angle in the box of Angle option; then, the angle of the hatch will be changed like this.

Step 17: If you want to decrease the visibility of the hatch line, then decrease the value of the Hatch Transparency option after selecting your desired hatch. I will change the value to 60.

Step 18: Then, the visibility of my selected hatch will decrease like this.

In this way, you can use the hatch command in auto cad.

Conclusion

Now, after this article, you can understand what a hatch AutoCAD is and how you can handle the parameters of it for making patterns and cross-section on the object of your drawing. You can make a good command of it by practicing it.

Recommended Articles

This is a guide to Hatch AutoCAD. Here we discuss the Introduction, how to use Hatch AutoCAD in a step by step manner. You can also go through our other related articles to learn more –

How Does Size Command Work In Linux?

Definition of Linux Size

The size command in Linux will allow listing the section size and the total size of the object files or the archived files in its argument list. In this tutorial, we will discuss its syntax, how to size command is used in Linux, its options, and its usages with different examples.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Syntax of size command in Linux:

We can use the size command in Linux in a different format with different options, as shown below:

[–help] [–common] [objfile…]

How Does Size Command Work in Linux?

Size commands in Linux can be used in different ways with its options. Below are the options that can be used with the size command in Linux and its description.

Options Description

We can select the output style by mentioning the format either in SysV or Berkeley.

To display the numbers in order of octal, decimal, or hex.

-t        –totals To print the total size for Berkeley format only.

–common To print the total size of *COM* syms

 To set the binary object file format

 To scan the options from object-file

-h        –help To display the list of options available in the size command.

-v        –version To display the version of the program.

Examples of Linux Size Command

Following are the examples are given below:

1. To Get the Default Size Output

Syntax:

size directory_name

Example:

size /usr/var/log

The above result is in Berkeley format, and we can also get the same output in three different commands, as shown below:

2. Default File Option

In the current directory, it will check for ‘a.out’ file and calculate the size, displaying the result in Berkeley format.

Syntax:

size

Example:

size

3. To Get the Output in SysV Format

The output, when generated in SysV format, will print different sections along with the size and address of each section name.

Syntax:

size –format=SysV dir_name

Example:

size --format=SysV /usr/var/log

4. To Specify the Output Value in Decimal

When we pass the option ‘-d’ with the argument list, we will get the result in decimal value format as given in the example below.

Syntax:

size -d dir_name

Example:

size -d /usr/var/log

5. To Specify the Output Value in Octal Format

When we pass the option ‘-o’ with the argument list, we will get the result in octal value format as given in the example below.

Syntax:

size -o dir_name

Example:

size -o /usr/var/log

6. To Specify the Output Value in Hex Format

When we pass option ‘-x’ with the argument list, we will get the result in hex value format as given in the example below.

Syntax:

size -x dir_name

Example:

size -x /usr/var/log

7. Option –radix

For decimals, we can use the number format as –radix=10.

Syntax:

size –radix=10 /dir_name

Example:

size --radix=10 /usr/var/log

Radix option in the size command is used to specify the format number instead of using decimal, hex, or octal. For decimals, we can use the number format as –radix=10.

Syntax:

size –radix=10 /dir_name

Example:

Radix option in the size command is used to specify the format number instead of using decimal, hex or octal. For octal, we can use the number format as –radix=8.

Syntax:

size –radix=8 /dir_name

Example:

size -o /usr/var/log

Radix option in the size command is used to specify the format number instead of using decimal, hex, or octal. For hex, we can use the number format as –radix=16.

size --radix=16 /dir_name

Example:

size --radix=16 /usr/var/log

We can use only format numbers as 10,8,16 for decimal, octal, and hex, respectively. When we use other format numbers, we will get an error saying “Invalid radix.” Below is an example of an invalid radix format.

size --redix=12 /usr/var/log

8. To Display the Common Symbol Count

The common option allows printing the total number of all common symbols in the object file. By default, the format will take Berkeley file format; this will also be used to include in the value for column “bss.”

Syntax:

size -A --common /dir_name

Example:

size -A --common /usr/var/log

Option -A is used for SysV format. In the above example, the last line having *COM* will give the value.

9. To Display the Total in Berkeley Format

The option -t (or –totals) allows in displaying the new line at the end of the result that will print the value of all the object files that are in the list.

Syntax:

size -t /dir_name

Example:

size -t /usr/var/lo*

Conclusion

The size command in Linux is a very important command that will allow listing the section size and the total size of the object files or the archived files in its argument list. When the object file is not specified in the parameter list, the default file name used is ‘a.out’. The output formats can be displayed in different formats, such as decimal, octal, or hexadecimal. The tutorial above explains various options and provides examples to enhance understanding of these output formats.

Recommended Articles

We hope that this EDUCBA information on “Linux Size” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

Update the detailed information about How To Use The Ps Command In Linux To Kill Process on the Kientrucdochoi.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!