Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

0 votes
1 answers
1942 views
How to see the current routed connections?
I'm running a router that is using linux; I want to see connection statistics from internal network to external network(s) (NAT router); how do I do this? I've tried using `netstat` but of course its only the local router connections. I can see the connection information if I setup something like an...
I'm running a router that is using linux; I want to see connection statistics from internal network to external network(s) (NAT router); how do I do this? I've tried using netstat but of course its only the local router connections. I can see the connection information if I setup something like an IDS and mirror; but I do not want to do this.
user26053
Jul 25, 2017, 04:31 PM • Last activity: Jun 2, 2025, 02:08 PM
150 votes
23 answers
193904 views
Is there a way to get the min, max, median, and average of a list of numbers in a single command?
I have a list of numbers in a file, one per line. How can I get the minimum, maximum, *median* and *average* values? I want to use the results in a bash script. Although my immediate situation is for integers, a solution for floating-point numbers would be useful down the line, but a simple integer...
I have a list of numbers in a file, one per line. How can I get the minimum, maximum, *median* and *average* values? I want to use the results in a bash script. Although my immediate situation is for integers, a solution for floating-point numbers would be useful down the line, but a simple integer method is fine.
Peter.O (33644 rep)
May 25, 2011, 04:42 AM • Last activity: Dec 31, 2024, 04:35 PM
1 votes
0 answers
41 views
Interruptible disk usage tallies for users?
I want to obtain, for every one of my system's users (or at least, every one with a home directory under `/home`), the amount of disk space their files use. I have root access, but - there are many users with lots and lots of files, and the directory is an nfs-mount. So, counting is kind of slow; an...
I want to obtain, for every one of my system's users (or at least, every one with a home directory under /home), the amount of disk space their files use. I have root access, but - there are many users with lots and lots of files, and the directory is an nfs-mount. So, counting is kind of slow; and my machine may be rebooted in the process, so I need to be able to resume counting after the machine is up again. What would be a decent way of achieving this? I don't very much mind the output format. Notes: * I can't set quotas. I mean, I have root access, but I don't get to do what I want.
einpoklum (10753 rep)
Dec 15, 2024, 04:27 PM • Last activity: Dec 15, 2024, 05:35 PM
6 votes
4 answers
2843 views
How can I see i/o stats for a briefly running process?
For long running processes like init, I can do things like $ cat /proc/[pid]/io What can I do if I want to see stats for a briefly running process such as a command line utility like ls? I don't even know how to see the pid for such a briefly running process...
For long running processes like init, I can do things like $ cat /proc/[pid]/io What can I do if I want to see stats for a briefly running process such as a command line utility like ls? I don't even know how to see the pid for such a briefly running process...
labyrinth (763 rep)
Jul 22, 2014, 05:13 PM • Last activity: Oct 10, 2024, 03:52 PM
-1 votes
1 answers
93 views
I need help obtaining a static IP address for my SIM card
I am currently experiencing a problem with my SIM card, supplied by KPN, which is unable to obtain a static IP address in a stable manner. Despite several attempts to configure it, the problem persists and this is affecting the connectivity of the device. Here's what I've tried so far: Manually conf...
I am currently experiencing a problem with my SIM card, supplied by KPN, which is unable to obtain a static IP address in a stable manner. Despite several attempts to configure it, the problem persists and this is affecting the connectivity of the device. Here's what I've tried so far: Manually configuring the IP address settings in the device settings. Exploring the use of APM (Application Performance Monitoring), with no success in obtaining a stable static IP address. At present, I'm continuing to run tests, but the kit is no longer able to connect to the Internet. Have you encountered a similar problem or do you have any advice on how to resolve this? Any help or suggestions would be greatly appreciated. Thank you in advance for your help.
Guillaume Mirabel (1 rep)
Jun 19, 2024, 04:48 PM • Last activity: Jun 19, 2024, 05:50 PM
0 votes
1 answers
43 views
getting started with PDL for cluster analysis PDL::Stats::Kmeans
I guess first up is the Question " is perl data language dead ?" I'm not finding any active discussions or user q&a sorry for not tagging this better I dont have the rep' my problem area is to analyse electrical power switching events and tie back readings of reactive and resistive loads aiming to p...
I guess first up is the Question " is perl data language dead ?" I'm not finding any active discussions or user q&a sorry for not tagging this better I dont have the rep' my problem area is to analyse electrical power switching events and tie back readings of reactive and resistive loads aiming to point back at specific items of plant hardware. So I thought cluster analysis and got a steer towards PDL In a perl script I write
PDL::IO::DBI "rdbi2D;
use PDL::Stats::KMeans;
my $sql = "select resistv_chg,reactv_chg from metered_events where matched_event_id is not null";
my $pdl = rdbi2D( $dbh, $sql );  # pdl info tells me that i have a 2D array of 1400 x 2
my $k = $pdl->kmeans( {} );
in perldebug executing that call to kmeans() kicks off a flurry of output all of which means nada to me I should expect about 10 to 15 distinct clusters given my installation Has anyone any ideas about PDL these days ? Is there a better choice of tool
aldobranti (1 rep)
Nov 21, 2023, 08:55 PM • Last activity: Jan 14, 2024, 08:16 PM
2 votes
1 answers
979 views
Best way to group & count lines on stdin?
Since time immemorial I have used `... | sort | uniq -c | sort -nr` to group & count input lines, to count how many of each line there is in the input. Is there any better way? Have I just picked up a bad habit? Is there a better way using standard unix tools that will be installed on Ubuntu Linux 1...
Since time immemorial I have used ... | sort | uniq -c | sort -nr to group & count input lines, to count how many of each line there is in the input. Is there any better way? Have I just picked up a bad habit? Is there a better way using standard unix tools that will be installed on Ubuntu Linux 18.04+ (or things that are an apt-get away?)
Amandasaurus (1336 rep)
Aug 14, 2020, 01:13 PM • Last activity: Dec 2, 2023, 11:31 AM
0 votes
0 answers
123 views
How can I get user's idle time of whole day?
How can we get the user's idle time, defined as the time during which the user hasn't struck the keyboard or even made a mouse movement in Ubuntu 22.04. It should display with the username, the user's login, logout time & idle time interval of the user within the whole day. Can anyone let me know, h...
How can we get the user's idle time, defined as the time during which the user hasn't struck the keyboard or even made a mouse movement in Ubuntu 22.04. It should display with the username, the user's login, logout time & idle time interval of the user within the whole day. Can anyone let me know, how can we do that? I want this idle time of the user so that I get the details of the user who is idle for minutes/hours at that specific day time interval, in a whole day. Is there any script or command to get the details of the user for the particular date & time at which the user was idle?
Mahesh Garole (1 rep)
Nov 10, 2023, 10:06 AM • Last activity: Nov 22, 2023, 01:32 PM
0 votes
0 answers
101 views
Cumulative CPU time across reboots
**How can I record and view cumulative CPU time on system across reboots?** Essentially, it should be like the `TIME+` column of `top`, but not per process. In other words, like `vnstat`, but for CPU time. I am the only user on the system. ###### `vnstat`: ``` daily rx | tx | total | avg. rate -----...
**How can I record and view cumulative CPU time on system across reboots?** Essentially, it should be like the TIME+ column of top, but not per process. In other words, like vnstat, but for CPU time. I am the only user on the system. ###### vnstat:
daily
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
     yesterday      4.30 MiB |    2.42 MiB |    6.72 MiB |    0.64 kbit/s
         today      2.03 MiB |    1.07 MiB |    3.10 MiB |    0.59 kbit/s
     ------------------------+-------------+-------------+---------------
     total          6.33 MiB |    3.49 MiB |    9.82 MiB |    0.62 kbit/s
###### Desired:
daily
                     CPU time | % of day 
     -------------------------+-------
     2023-08-01         0 s    |  0.0%
     2023-08-02         0 s    |  0.0%
     2023-08-03         0 s    |  0.0%
     2023-08-04      1052 s    |  1.2%
     2023-08-05      7200 s    |  8.3%
     --------------------------+--------
     total           8252 s    |  4.8% (avg)
**I'm really only interested in the total CPU time and CPU seconds ÷ seconds since monitoring started.**
wjwrpoyob (460 rep)
Aug 28, 2023, 12:42 AM • Last activity: Sep 16, 2023, 01:16 AM
6 votes
1 answers
19612 views
NIC statistics explanation (ethtool -S eth1)
What is the meaning of each of the results from `ethtool -S eth1` command? For example, when I used `ethtool -S eth1`, I got something like this: >root@localhost ~]# ethtool –S eth1 >NIC statistics: tx_packets: 2654 rx_packets: 3960 tx_errors: 0 rx_errors: 316 rx_missed: 0 align_errors: 9194 tx_sing...
What is the meaning of each of the results from ethtool -S eth1 command? For example, when I used ethtool -S eth1, I got something like this: >root@localhost ~]# ethtool –S eth1 >NIC statistics: tx_packets: 2654 rx_packets: 3960 tx_errors: 0 rx_errors: 316 rx_missed: 0 align_errors: 9194 tx_single_collisions: 0 tx_multi_collisions: 0 unicast: 3396 broadcast: 198 multicast: 366 tx_aborted: 0 tx_underrun: 0 Is it correct that tx_packets, rx_packets - are transmitted and received packets? But what with the rest of the results?
Artux (61 rep)
Mar 15, 2015, 12:58 PM • Last activity: Aug 2, 2023, 08:51 AM
0 votes
1 answers
62 views
Calculate Traffic when vnstat service stopped
How can I temporarily stop the `vnstat` traffic calculation? I even stop the service, but the traffic is still calculated!
How can I temporarily stop the vnstat traffic calculation? I even stop the service, but the traffic is still calculated!
Ali Saleh (1 rep)
Jun 15, 2023, 09:38 AM • Last activity: Jun 15, 2023, 10:42 AM
0 votes
1 answers
552 views
How to get the most trusted and accurate linux distro stats?
I need the Linux distros usage statistics. I need this data to make a more informed decision for our future technology choices. However, I can't find the data. It seems that [DistroWatch](https://distrowatch.com/dwres.php?resource=popularity) is a good place to start. But it only shows the trends ba...
I need the Linux distros usage statistics. I need this data to make a more informed decision for our future technology choices. However, I can't find the data. It seems that [DistroWatch](https://distrowatch.com/dwres.php?resource=popularity) is a good place to start. But it only shows the trends based on visits to their sites: > The counters are no longer displayed on the individual distributions pages, but all visits are logged. Only one hit per IP address per day is counted. Though that might be a good indicator, it's not the true **usage** data. It's more related to the hype around the distros. I might run Debian, but visit their site and read more about Linux Mint. Another option seemed to be [TechMint](https://www.tecmint.com/linux-distributions/) . However, their data is also different from the DistroWatch. Here, we see that Ubuntu and Debian are at the top of the list (along Mint) but in DistroWatch they are at much lower ranks. And [StatCounter](https://gs.statcounter.com/os-market-share) does not have data for Linux distros only. Or at least I can't find it. Is there a formal, well-established place to give us Linux usage stats?
Saeed Neamati (841 rep)
Mar 6, 2023, 07:18 AM • Last activity: Mar 6, 2023, 07:30 AM
0 votes
1 answers
200 views
How to get CPU statistics PER PROCESSOR on AIX without requiring root privileges?
I want to get the per processor statistics for my AIX machines. I can use the ‘**sar -P ALL 1 1**’ ([Documentation][1]) command but it requires root privileges. [![enter image description here][2]][2] Is there a command that can give me PER PROCESSOR statistics **without requiring root privileges**?...
I want to get the per processor statistics for my AIX machines. I can use the ‘**sar -P ALL 1 1**’ (Documentation ) command but it requires root privileges. enter image description here Is there a command that can give me PER PROCESSOR statistics **without requiring root privileges**? P.S. : I explored **lparstat** but it does not give PER PROCESSOR statistics.
Purven Dudhaiya (1 rep)
Oct 11, 2022, 10:31 AM • Last activity: Dec 5, 2022, 06:50 PM
1 votes
0 answers
357 views
How can I get the bit error rate (BER) for a given connection?
I would like to know the bit error rate (BER), calculated as (total good TX/RX bits)/(total good/bad TX/RX bits). I have looked through available information from the rtnetlink library as well as the information available in /sys/class/net/ /statistics but I cant seem to find the information necessa...
I would like to know the bit error rate (BER), calculated as (total good TX/RX bits)/(total good/bad TX/RX bits). I have looked through available information from the rtnetlink library as well as the information available in /sys/class/net//statistics but I cant seem to find the information necessary to get this. Specifically I cant find error bits anywhere, but sys/class/net//statistics does contain total GOOD rx/tx bytes
sasukenebe (11 rep)
Nov 26, 2022, 09:54 AM
14 votes
5 answers
8903 views
How to gather byte occurrence statistics in binary file?
I'd like to know the equivalent of cat inputfile | sed 's/\(.\)/\1\n/g' | sort | uniq -c presented in https://stackoverflow.com/questions/4174113/how-to-gather-characters-usage-statistics-in-text-file-using-unix-commands for production of character usage statistics in text files for binary files cou...
I'd like to know the equivalent of cat inputfile | sed 's/\(.\)/\1\n/g' | sort | uniq -c presented in https://stackoverflow.com/questions/4174113/how-to-gather-characters-usage-statistics-in-text-file-using-unix-commands for production of character usage statistics in text files for binary files counting simple bytes instead of characters, i.e. output should be in the form of 18383 57 12543 44 11555 127 8393 0 It doesn't matter if the command takes as long as the referenced one for characters. If I apply the command for characters to binary files the output contains statistics for arbitrary long sequences of unprintable characters (I don't seek explanation for that).
Kalle Richter (2252 rep)
Sep 23, 2014, 04:38 PM • Last activity: Sep 18, 2022, 02:25 AM
0 votes
1 answers
282 views
Why does Network Manager report no statistics for my networks?
I'm looking through the D-Bus API for Network Manager, on Centos Stream 8, and for the entire `org.freedesktop.NetworkManager.Device.Statistics` interface all the properties are showing 0 including `RxBytes` and `TxBytes`. This is for all network interfaces including the active ethernet port being u...
I'm looking through the D-Bus API for Network Manager, on Centos Stream 8, and for the entire org.freedesktop.NetworkManager.Device.Statistics interface all the properties are showing 0 including RxBytes and TxBytes. This is for all network interfaces including the active ethernet port being used to log into the machine and the loopback. Is there some other object type that actually has this information? Is the interface deprecated? Do I need to run a method to start recording somewhere? Do I need to subscribe to changes somehow? Is this related to nm-settings-ifcfg-rh? Netstat has no problem reporting these stats. And Ubuntu 22.04 reports them but only for loopback. Edit: I thought I was on the Ubuntu device but actually it was the Centos box.
davolfman (847 rep)
Aug 25, 2022, 11:24 PM • Last activity: Aug 30, 2022, 07:53 AM
0 votes
1 answers
32 views
Monitor how long per day or hour I'm close to my maximuim internet bandwith? So if it makes sense to buy an upgrade
for quite some time I'm working at home now. Recently I questioned if my current internet connection is good enough for my activity on my laptop. For some activities I notice a high internet usage, but I want clear facts and not just a gut feeling. So I wondered, if I can automatically monitor how m...
for quite some time I'm working at home now. Recently I questioned if my current internet connection is good enough for my activity on my laptop. For some activities I notice a high internet usage, but I want clear facts and not just a gut feeling. So I wondered, if I can automatically monitor how many seconds/minutes... per day or hour I'm close to my internet connection limit. So I can get clue if an upgrade makes sense to speed up my activity. Is there a tool for that? I looked at vnstat, but it's not what I'm looking for. Also I would need to look at Download and Upload separately.
keiki (275 rep)
Mar 7, 2022, 11:24 AM • Last activity: Mar 8, 2022, 11:45 AM
1 votes
0 answers
220 views
Count number of bytes read() from files on a file system
I have multiple XFS filesystems mounted on my Linux 5 machine. I'd like to know for one of them how many bytes were read() in a time period. Is there an easy way of doing that? I've been looking through /sys/fs and /proc/fs but there's only stats for the overall file system types. I guess these per-...
I have multiple XFS filesystems mounted on my Linux 5 machine. I'd like to know for one of them how many bytes were read() in a time period. Is there an easy way of doing that? I've been looking through /sys/fs and /proc/fs but there's only stats for the overall file system types. I guess these per-mount statistics might not be public; I could imagine I could hook up eBPF to the appropriate file-reading system call(s), but I have a) no idea how to do that effectively filtering down to only things on one mount.
Marcus Müller (47107 rep)
Dec 20, 2021, 10:51 AM
1 votes
1 answers
2353 views
How can you check how much of a bcache cache is currently in use?
I've got a setup that includes a bcache cache device serving multiple backing devices. I would like to know how much of it is currently in use because bcache only caches certain kinds of data.
I've got a setup that includes a bcache cache device serving multiple backing devices. I would like to know how much of it is currently in use because bcache only caches certain kinds of data.
Atemu (857 rep)
Nov 25, 2021, 03:39 PM
0 votes
3 answers
215 views
Extract maximum values for each objects from a file
I need to extract some values from a file in `bash`, on my CentOS system. In `myfile.txt` I have a list of objects called `Info_region` in which each object is identified with a code (eg. `BARD1_region_005` or `BIRC2_region_002` etc.) Moreover there are some others columns in which are reported some...
I need to extract some values from a file in bash, on my CentOS system. In myfile.txt I have a list of objects called Info_region in which each object is identified with a code (eg. BARD1_region_005 or BIRC2_region_002 etc.) Moreover there are some others columns in which are reported some numerical variable. The same object (same code name) can be repeated several times in my file. I also have a file that contains a completed list with all object codes without duplicates. I would like to obtain an output.txt file in which each object (code name) is reported only once as in my list-file.txt and I would like to associate to this the maximum possible values associated with that code name in myfile.txt. myfile.txt: (columns are separated by tab) Info_region Lig_score Lig_prevista Lig_prevista_+1 Int_score Expo_score Protac_score BARD1_region_005 0 3 3 0 1 1 BARD1_region_006 0 1 1 0 1 1 BIRC2_region_001 1 6 7 0 1 2 BIRC2_region_001 1 7 8 0 1 2 BIRC2_region_001 0 2 2 0 0 0 BIRC2_region_001 0 12 12 0 1 1 BIRC2_region_001 1 10 11 -1 1 1 BIRC2_region_001 1 2 3 0 1 2 BIRC2_region_001 1 0 1 0 1 2 BIRC2_region_001 1 6 7 0 1 2 BIRC2_region_002 0 0 0 0 1 1 BIRC2_region_002 1 0 0 -1 0.5 0.5 BIRC2_region_003 0 0 0 0 1 1 BIRC2_region_004 0 1 1 0 1 1 UHRF1_region_004 0 0 0 1 1 2 UHRF1_region_004 0 0 0 1 1 2 UHRF1_region_004 1 0 1 0 0.5 1.5 UHRF1_region_004 0 0 0 1 1 2 UHRF1_region_005 0 3 3 1 1 2 UHRF1_region_005 1 0 0 -1 1 1 file-list.txt: Info_region BARD1_region_005 BARD1_region_006 BIRC2_region_001 BIRC2_region_002 BIRC2_region_003 BIRC2_region_004 UHRF1_region_004 UHRF1_region_005 output.txt: Info_region Lig_score Lig_prevista Lig_prevista_+1 Int_score Expo_score Protac_score BARD1_region_005 0 3 3 0 1 1 BARD1_region_006 0 1 1 0 1 1 BIRC2_region_001 1 12 12 0 1 2 BIRC2_region_002 1 0 0 0 1 1 BIRC2_region_003 0 0 0 0 1 1 BIRC2_region_004 0 1 1 0 1 1 UHRF1_region_004 1 0 1 1 1 2 UHRF1_region_005 1 3 3 1 1 2 Could someone help me please? Thank you!
Tommaso Palomba (145 rep)
Apr 9, 2021, 11:05 AM • Last activity: Apr 9, 2021, 11:27 PM
Showing page 1 of 20 total questions