Trending December 2023 # How To Use The Ss Command To Monitor Network Connections In Linux # Suggested January 2024 # Top 13 Popular

You are reading the article How To Use The Ss Command To Monitor Network Connections In Linux updated in December 2023 on the website Katfastfood.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 Ss Command To Monitor Network Connections In Linux

If you use Linux, there will probably come a time when you need to know more about your network. Several tools can help you do this, and some are more complicated than others. The ss command is something you can rely on being installed on many machines, so it’s handy to know.

What Is the ss Command?

While the two-letter command’s name may seem arcane, it’s actually quite simple. Like many Linux/Unix commands, the name is an abbreviation of what the command does. Here, ss stands for Socket Statistics.

Socket Statistics is a replacement for the old netstat tool, aimed at being easier to use and understand. It simply displays information about sockets. This includes not only TCP and UDP sockets, the most commonly used types, but also DCCP, RAW, and Unix domain sockets.

Basic Usage

The simplest way to use the ss command is to simply run it without arguments. This will display quite a lot of data, so you probably want to pipe it through less for easier reading.

For example, you can list only TCP sockets.

Or, you can list UDP sockets instead.

ss

-u

By default, these options only list sockets that have established connections. To list all the TCP sockets that are either listening or connected, you can run the following:

ss

-t

-a

So far, this all seems pretty simple. Let’s learn more.

Useful Things You Can Do With the ss Command

Now that you’re familiar with the basics, it’s time to start using the ss command to monitor your network. There are many things you can do, but here are a few ideas to get you started.

Monitoring TCP States

If you’re familiar with networking, you already know this, but TCP connections have different stages. These detail the entire lifespan of a connection. We can drill down to certain types of stages using the ss command.

In addition to the standard TCP states like “established” and “closed,” the ss command supports a few custom filters. For example, the “connected” state is simply every TCP state with the exception of “listening” and “closed.” To use this, run the following:

ss state connected IPv4 and IPv6

If your network uses a combination of IPv6 and IPv4 addresses, you can filter them using the ss command. Just use the -4 or -6 flags. If you want to see all IPv4 connections, you can tie in TCP state.

If you wanted to see all IPv6 sockets, you would simply run the following:

ss

-6

What Process Is Using this Socket?

If you know a socket is listening but don’t know why, you can easily track this down. Running the following will show you the name and process ID of all connected IPv4 TCP sockets.

Displaying a Summary

Sometimes you just want a brief rundown of the sockets on a given machine. This is also one of the easier commands to run, as it consists entirely of the letter “s” and one dash:

This gives a summary of all the sockets on your machine and displays whether they’re IPv4 or IPv6.

Want to Know More About Your Network?

This is just the beginning of what you can do with the ss command. It’s a powerful tool and one well worth learning. To dig deeper, open a terminal and look over the documentation in the tool’s man page. Just run man ss to get started.

If you’re looking to secure your machine, ss is handy, but it’s not the only tool available. Take a look at our guide to checking open ports on Linux to learn more.

Kris Wouk

Kris Wouk is a writer, musician, and whatever it’s called when someone makes videos for the web.

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 Ss Command To Monitor Network Connections In Linux

Guide To Chgrp Command In Linux

Introduction

In Linux, chgrp command is a useful tool for changing group ownership of files and directories. It is an important command for system administrators who need to manage user permissions and access control on a Linux system. chgrp command is also useful for collaborative work where users need to share files and directories with specific groups. In this article, we will explore chgrp command and its usage in detail.

What is chgrp Command in Linux?

The chgrp command is used to change group ownership of files and directories in Linux. chgrp command changes group ownership of a file or directory to a specified group. command is usually used in combination with chown command to change both user and group ownership of a file or directory. chgrp command can be used by root user or any user who has permission to change group ownership of a file or directory.

Syntax of chgrp Command

The syntax of chgrp command is as follows −

chgrp [options] new_group file/directory

The options that can be used with chgrp command are as follows −

-R, --recursive change files and directories recursively --dereference affect referent of each symbolic link --no-dereference affect symbolic links themselves --preserve-root do not operate recursively on '/' --reference=RFILE use RFILE's group rather than specifying a group Examples of chgrp Command

Let’s explore some examples of chgrp command.

Change Group Ownership of a File

To change group ownership of a file, use following command −

chgrp new_group file.txt

This command changes group ownership of file “file.txt” to “new_group”. Note that you need to have necessary permissions to change group ownership of file.

Change Group Ownership of a Directory

To change group ownership of a directory, use following command −

chgrp new_group directory

This command changes group ownership of directory “directory” to “new_group”. Note that you need to have necessary permissions to change group ownership of directory.

Change Group Ownership Recursively

To change group ownership of a directory and all its contents recursively, use following command −

chgrp -R new_group directory

This command changes group ownership of directory “directory” and all its contents recursively to “new_group”. Note that you need to have necessary permissions to change group ownership of directory and its contents.

Change Group Ownership of Symbolic Links

By default, chgrp command affects referent of each symbolic link. However, if you want to change group ownership of symbolic links themselves, use following command −

chgrp --no-dereference new_group symlink

This command changes group ownership of symbolic link “symlink” to “new_group” itself, rather than affecting referent of symbolic link.

Preserve Root Directory

When using chgrp command recursively, you can use –preserve-root option to prevent command from operating recursively on root directory ‘/’. Use following command −

chgrp --recursive --preserve-root new_group /

This command changes group ownership of all files and directories under root directory ‘/’ recursively to “new_group”, but it does not change group ownership of root directory itself.

In addition to examples provided, there are a few other things to keep in mind when working with chgrp command.

Firstly, it is important to note that chgrp command only changes group ownership of files and directories. To change user ownership as well, you can use chown command instead, or combine two commands using syntax −

chown new_owner:new_group file/directory

This command changes both user and group ownership of file or directory to specified values.

Another important consideration when working with chgrp command is use of file permissions. group ownership of a file or directory can affect access permissions of other users in that group. For example, if a file is owned by group “sales” and has read and write permissions for that group, any user in “sales” group can read and modify that file.

To check permissions and ownership of a file or directory, you can use ls command with -l option −

ls -l file.txt

This command will display file’s permissions, ownership, and group ownership in a long format.

Finally, it is important to remember that chgrp command requires administrative or root permissions to be executed. This is because changing file ownership and permissions can have significant consequences for security and functionality of a system. Make sure to use chgrp command only when necessary, and with appropriate level of access.

Conclusion

The chgrp command is an important tool for managing group ownership of files and directories in Linux. It is a useful command for system administrators and collaborative work. In this article, we explored chgrp command and its usage in detail. We also looked at some examples of chgrp command, including changing group ownership of files, directories, and symbolic links, as well as using recursive and preserve-root options.

While chgrp command can be a powerful tool for managing file and directory permissions, it is important to use it carefully and with caution. Make sure you understand permissions and ownership of files and directories you are working with, and double-check command before executing it to avoid unintended consequences.

In summary, chgrp command is an essential tool for managing group ownership of files and directories in Linux. Understanding how to use it effectively can help system administrators and users to manage permissions and access control on a Linux system. With examples and syntax provided in this guide, you should be well on your way to using chgrp command with confidence.

Pianobar: Listen To Pandora From The Linux Command

If you are one of those command line geeks who like listening to music while doing work, you’ll be thrilled to know that Pandora, the popular Internet radio service, can be accessed through command line as well. There exists an open source command line Pandora client by the name of Pianobar, which makes it possible.

The command line application provides the following features:

Play and manage (create, add more music, delete, rename, …) stations

Rate songs and explain why they have been selected

Upcoming songs/song history

Customize keybindings and text output

Remote control and eventcmd interface (send tracks to chúng tôi for example)

Proxy support for listeners outside the USA

In this article, we will discuss how to install, configure, and use the command line application on Linux.

Installation

If you’re running Debian, or a Debian-based system (like Ubuntu, Mint, and more), you can easily install Pianobar by running the following command:

sudo

apt-get install

pianobar

But if you’re using some other distribution, or the application is not available in your distribution’s repositories, you can download its source code and build it from scratch. The source code is available on GitHub.

Configure

Once Pianobar is successfully downloaded and installed, the next step is to configure it. Although you can run the app right away by running the pianobar command, you’ll probably get frustrated as you’ll have to enter the login credentials every time the command is run.

To configure the application, first create the “config” directory using the following command:

mkdir

-p

.config

/

pianobar

Then navigate to the new directory and create a configuration file called “config”

cd

~

/

.config

/

pianobar

touch

config

Open the newly created “config” file, and enter the following information:

user =

[

your-pandora-username

]

password =

[

your-pandora-password

]

audio_quality = high

Replace the square brackets and the text within them with your Pandora username and password. As for “audio_quality”, other available values are “medium” and “low.”

Another point worth mentioning is that you cannot access Pandora outside of the US. So, if you are trying to access Pandora from a location other than the US, add the following line to your config file as well:

This is the most basic configuration. For more configuration options, refer to Pianobar’s man page.

Using Pianobar

Once you’ve configured the application, it’s very easy to use; just run the following command:

pianobar

The application will login into Pandora service, fetch the stations and ask you to select one. Once done, it will fetch the corresponding play list and start playing the songs.

The application also provides various commands through which you can do stuff like create a new station, delete a station, and more. Here is the complete list of commands (which you can get on console by pressing ?):

+ – love song

– – ban song

a – add music to station

c – create new station

d – delete station

e – explain why this song is played

g – add genre station

h – song history

i – print information about song/station

j – add shared station

n – next song

p – pause/resume playback

q – quit

r – rename station

s – change station

t – tired (ban song for 1 month)

u – upcoming songs

x – select quickmix stations

( – decrease volume

) – increase volume

= – delete seeds/feedback

v – create new station from song or artist

P – resume playback

S – pause playback

^ – reset volume

Conclusion

Himanshu Arora

Himanshu Arora is a freelance technical writer by profession but a software programmer and Linux researcher at heart. He covers software tutorials, reviews, tips/tricks, and more. Some of his articles have been featured on IBM developerworks, ComputerWorld, and in Linux Journal.

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 Process Monitor And Process Explorer

Do you often use Task Manager on your Windows 10 PC to keep track of the different processes on your system and how much CPU or memory they’re using? If so, you might find that you prefer two alternative options – Process Monitor or Process Explorer.

Both are free tools that you can install on your Windows 10 PC. They include the same information you can see in Windows Task Manager and a whole lot more as well.

Table of Contents

What Is Process Monitor?

Specifically, these are details about events triggered by specific processes. 

The following process information fields are selected by default when you first launch the app.

Process Name

Path

Detail

Result

Operation

Time of Day

Process ID (PID)

You aren’t limited to just view process information with this tool. You can also set filters on any field to limit what data gets displayed, log process events for troubleshooting, and a process tree that lets you see the relationship between parent and child processes.

What Is Process Explorer?

Process Explorer is the best tool for understanding how different applications are working on your system. Through an innovative tree structure, it’ll show you a breakdown of what files, directories, and other processes each parent process is controlling. 

You can use Process Explorer in “handle mode”, which helps you see what window handles each process has opened, or “DLL mode”, which shows you DLLs and memory mapped files each process has opened.

This makes Process Explorer extremely useful when troubleshooting or debugging applications that are running on your computer.

Now that you know what each of these free SysInternals utilities is used for, let’s take a closer look at how you can use each of these on your own Windows 10 PC.

How to Use Process Monitor

After you extract the Process Monitor files you’ll see different files to launch the utility. If you’re running a 64-bit Windows system, choose the file named chúng tôi If not, then choose the chúng tôi file.

From the main Process Monitor window, you can launch a view that’s similar to the Process Explorer app. This is the process tree view. To view this, just select the small document icon with an image of a tree diagram on it.

Some information you can see in this view includes the parent process and all of the processes it has launched. You can see its launch command, the app developer (if available), how long it’s been running, and the date it was launched. 

It’s not as informative as Process Explorer, but it’s a nice quick view to see much of the same information.

Create a Process Monitor Filter

This window shows you how filtering works in Process Monitor. The first dropdown lets you select the object for your filter. In this case it’s the Process Name. The next dropdown is the operator like is, is not, less than, etc. The field is where you can type or select your filter, and whether you want to Include or Exclude those entries.

When you select Add, it’ll add that new filter to your list, and modify the overall view of processes accordingly.

To create a new filter, select the Filter menu, and select Filter. 

This will open the same window but with the filter blank. Just select each dropdown, enter the filter item you want to exclude or include, and add it to your filter list. 

Once you select OK it’ll update your main view to include your new filter.

The most useful feature of Process Monitor is logging system events during some action. You can log system events as follows:

Press the magnifying glass Capture icon to stop logging.

Select the eraser on paper Clear icon to clear the log.

Press the Capture icon again to start logging.

Select Filter and Enable Advanced Output.

Recreate the issue.

Select the Capture icon again to stop logging.

Select the disk Save icon to save the log to your computer.

You can review the log to see all process events that occurred when you recreated the issue or error you’re trying to troubleshoot.

Exploring Deeper with Events

When you select specific events in Process Monitor, you can explore more details through the Event menu.

Select the event you want to examine. Then select the Event menu and select Properties.

This shows all properties for the event. The Event tab shows mostly what was in the main Process Monitor window. The Process tab shows you things like the path to the application and the launch command line, as well as modules used by the process. The Stack tab provides modules stored in memory by the process and their details.

You can access just the Stack tab by selecting Stack in the Events menu instead.

If you want to keep a close eye on any single events, select it and then select the Event menu and select Toggle Bookmark.

This will highlight the event so it’s easier to track.

You can also see the Registry entries for any process by selecting the Event menu and selecting Jump To. 

This is a quick way to see any registry entries you may want to toggle to configure that application. 

You’ll see five icons to the right side of the toolbar that you can use to fine-tune the default filters.

You can use these to turn on or off each of the following filters:

Registry activity

File system activity

Network activity

Process and thread activity

Profiling events

How to Use Process Explorer

Use the same approach for 32-bit or 64-bit when you launch Process Explorer.

The View menu is where you can customize what process information gets displayed in each pane.

Use Lower Pane View to change the data displayed there from Handles to DLLs.

The most important menu here is Process. The following is what each menu option will show you and let you control.

Set Affinity shows which CPUs the selected process can execute on. You can enable or disable any of the processors if you like.

Set Priority lets you increase or discrete the priority that the CPU gives that process. This is a good way to troubleshoot lagging or slow-running applications to see if it’s an issue with too many other processes running.

The next four options let you control each process.

These include:

Kill Process: Force stop an individual process

Kill Process Tree: Force stop the process and all child processes

Restart: Stop and start the selected process

Suspend: Suspect the selected process

You can create dump or minidump files associated with the selected process by selecting the Process menu and selecting Create Dump. Then choose whether you want a Minidump or a Full Dump.

If you select Check VirusTotal in the Process menu, Process Explorer will submit hashes for the files associated with the process and DLLs to chúng tôi VirusTotal will scan and analyze those for any virus activity. You will need to agree to VirusTotal’s terms of service before you can use this feature.

Finally, if you select Properties from the Process menu, you can view a wide variety of properties about the selected process.

Should You Use Process Monitor or Process Explorer?

While these two utilities are similar, they aren’t the same. Process Monitor is better used if you need to track how your processes are interacting with your system. It lets you monitor and log events that are triggered by each process.

It can help you see whether the interaction between your processes and your system is causing errors or behaving abnormally.

Process Explorer, on the other hand, is heavily process focused. It helps you see the relationships between parent processes and its child processes. It also lets you dig much more deeply into parameters and properties of each process, far more than any other available Windows utility.

How To Monitor The Air Quality In Your Home

What’s in the air in your home?

These are the harmful pollutants most likely to be in the air in your home:

VOCs

VOC stands for volatile organic compound. You may see the group referred to as TVOC: total volatile organic compounds. VOCs are gases, often emitted by cleaning products when they’re used. Some examples of well known VOCs are the carcinogens benzene and formaldehyde, and toluene, which is toxic.

VOCs can come from a range of sources but the ones in your home are likely to be from cleaners or disinfectants, air fresheners, cosmetics and deodorants, dry-cleaned clothing, a wood burning stove or fire, paint, varnish, adhesives or sealants.

If you’re painting or cleaning, it’s a good idea to open the windows, although this isn’t an ideal solution if you live next to a road.

Apart from a chemical smell, there’s no way to know what the VOC levels are like in your home, so you’ll need to buy an air quality monitor.

Many air purifiers will display VOC content, so if you’re about to embark on a big decorating project, you might just want to invest in one straight away. Our round up of the best air purifiers we’ve tested will help you to find the one that’s right for you.

If you’d like a dedicated monitor, we tested the Airthings Wave Plus. You can read our review to find out if it’s a good fit. Bear in mind that it doesn’t measure particulate matter. It’s available from Amazon and Airthings.  

Particulate matter

This is also known as particle pollution, PM or aerosol. Basically, it’s all the little bits floating about in the air that you might breathe in. It’s a mixture made up of solid particles and drops of liquid – dirt, dust, pollen, soot, smoke, chemicals and metals.

The concerning particles are the very small ones: those under 10 micrometres across. (For reference, a human hair is approximately 75 micrometres thick, so 10 micrometres is very tiny indeed.) 

Larger particles are usually filtered out in the nose and throat but particles of this size can make their way into your lungs and affect your heart, your respiratory system and your immune system. 

Particulate matter is one of the air pollutants that leave visible signs, although obviously you can’t see the smaller, more dangerous particles.

If you have an open fire or you live near a busy road, you will probably have a lot of particulate matter in the air in your home. Other signs to look out for are high levels of dust or soot on surfaces.  

Carbon dioxide

Carbon dioxide occurs naturally in the air in very small amounts but in higher concentrations, it can make a room feel stuffy and stale. People may develop a headache or feel drowsy or unable to concentrate. 

If you have a new home, it may be more airtight for energy efficiency, and is more likely to have concentrated amounts of carbon dioxide in the air. You can combat high carbon dioxide levels by making sure that air can circulate around your home but if it’s an ongoing concern, you should consider buying an air quality monitor.

Carbon monoxide

Every year, 60 people in England and Wales die from accidental carbon monoxide poisoning. If you have a poorly installed or maintained appliance like a cooker, a heater or a central heating boiler, or if an appliance is damaged or malfunctions, you may be at risk of poisoning from this odourless, colourless gas.

The best way to protect yourself is with a carbon monoxide detector. Fortunately, these are cheap and effective. Every household should have at least one of these, depending on the size of your home. If you’re living in rented accommodation and didn’t buy your own appliances, you should buy one right now.

If you’re in the UK, the Fireangel CO-9B carbon monoxide alarm has a 7-year life and is available from Amazon for under £20. In the US, the First Alert CO710 carbon monoxide detector has a ten-year battery and is available from Amazon for less than $30. 

Radon

Radon is a radioactive gas naturally created by the decay of small amounts of uranium in soil and rocks. It’s the second leading cause of lung cancer after smoking cigarettes.

Every area has some radon, but it’s recommended that you test for the gas if you live in an area that is more likely to be highly affected. If you’re in the UK, you can use this map from Public Health England to find out whether your area is high or low risk.

Our recommended air quality monitor, the Airthings Wave Plus, has built-in radon detection. You can read our review to find out more.

Humidity

Most air quality monitors will also monitor humidity levels. However, if the air in your home is too damp, you’ll probably notice other signs, such as foggy windows, peeling or cracking paint inside, and mould growth on inner walls. If you often let clothes air dry indoors, the air in your home may be too damp. 

If you already know that damp is an issue, you could bypass an air quality monitor and go for a dehumidifier and air purifier in one. We tested and reviewed the Meaco Arete One – it’s a compact and efficient appliance with a medical grade H13 HEPA filter. You can use the air purifying function separately.

What Is Shebang And How To Use This Character Sequence In Linux

One of the best features of Linux is that you can easily create scripts that are designed to automate and simplify tasks. This can help when processing large groups of files, like log files if you’re a Systems Administrator or CSV and TXT files if you’re doing some kind of research. However, there’s one very specific set of characters that you have to understand to get scripting – the Shebang or #!. We answer all your questions about the Shebang in this tutorial, a guide on how to use this character set in Linux.

What Is the Shebang?

#! is used in a text file of some kind to load the proper interpreter for the code that’s below that file. You could write out a script like what is shown in the following image.

And run it like what is shown in this image.

That will work for you, but it may get annoying after a while. A better way to do it might be like this image.

And then run it like this.

Why Was the Shebang Invented?

While using the Shebang takes an extra step when creating the script, being able to use a ./ or “dot-slash” to run your scripts will make it easier down the road. The script takes care of which interpreter to pass the commands to, meaning you don’t have to remember. This is great if you’re scheduling it as a cron job or if you’re executing scripts from within other scripts.

It makes the system more simple to administer because regardless of whether you want Bash, Zsh, or Python to interpret the contents of the files, having that as the first line of your script will make it drop-dead simple.

How Do I Use the Shebang?

It’s very simple: just type it in the first line of your script file along with the absolute path to the interpreter you want to pass the commands to. Here’s a couple of examples:

#!/bin/bash

#!/bin/zsh

#!/usr/bin/env python3

Once that’s in the file, start typing below it. Once you’re done, save your file and make it executable by running one of the following commands:

chmod

755

SCRIPT-NAME

chmod

a+x SCRIPT-NAME

They will both accomplish the same thing. From there, all you have to do is run your script like this:

.

/

SCRIPT_NAME

And you’re done! It’s that simple.

If you enjoyed this guide on how to use the Shebang, make sure you check out some of our other Linux how-to’s, like our guides on fixing the “No space left on device” error and repairing a corrupted USB drive.

John Perkins

John is a young technical professional with a passion for educating users on the best ways to use their technology. He holds technical certifications covering topics ranging from computer hardware to cybersecurity to Linux system administration.

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.

Update the detailed information about How To Use The Ss Command To Monitor Network Connections In Linux on the Katfastfood.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!