Unix & Linux
Count distinct values of a field in a file
I have a file with one million lines. Each line has a field called transactionid, which has repetitive values. What I need to do is to count them distinctly. No matter how many times a value is repeated, it should be counted only once.
How are directories implemented in Unix filesystems?
My question is how directories are implemented? I can believe a data structure like a variable e.g. table, array or similar. Since UNIX is Open Source I can look in the source what the program does when it created a new directory. Can you tell me where to look or elaborate on the topic? That a directory “is” a file I could understand and is a directory really a file? I’m not sure that it is true that files are stored “in” files while still in way you could say the word file about nearly anything and I’m not sure what absolutely not is a file since you could call even a variable a file. For example a link is certainly not a file and a link is like a directory but then this violates that a directory is a file?
How does lookup in $PATH work under the hood?
There’re way too many articles/resources on the web that teaches people HOW to set the environment variable PATH so that they can use the short hand of java or python etc instead of the absolute path in command line interface.
How do I look at the source code for a command?
Find out which package it’s in
Unexpected non-null encoding of /proc//cmdline
I am parsing the /proc/pid/cmdline value for a number of processes on my Linux system (Ubuntu 16.04) and have found that while most of the entries are null-encoded, as expected, at least one uses spaces for delimiters which I find unexpected.
Why is the array empty after the while loop?
I try to initialize an array in bash-4.2 next way: ring=() ls -las | tail -n +4 | while read line > do > ring+=("$line") > echo ${ring[-1]} > done 3924 -rw-r–r– 1 username group 4015716 Mar 23 15:14 script.jar 4 -rw-r–r– 1 username group 9 Feb 29 12:40 rec.lst 5541 -rw-r–r– 1 username group … Read more
How to get vim to work with tmux properly?
I’m trying to figure out how to get vim and tmux play together.
options override for openssh client configuration
Since I want to protect my ssh connections, I set some global cipher suite options to restrict set of used algorithms. But recently I’ve encountered a server which doesn’t support some of those algorithms. So, I need to selectively enable deprecated algorithms for a specific host record in client (my system) configuration.
Access history of a file
I was wondering if there are any tools to keep track of the access history of a file. I know of stat, but as far as I understand, it only returns information about the last time the file was accessed. Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the … Read more