Can I symlink multiple directories into one?

No. You would have to symbolically link all the individual files. What you could do is to create a job to run periodically which basically removed all of the existing symbolic links in images_all, then re-create the links for all files from the three other directories, but it’s a bit of a kludge, something like … Read more

How to kill process inside container? Docker top command

When I reproduce your situation I see different PIDs between docker top <container> and docker exec -it <container> ps -aux. When you do docker exec the command is executed inside the container => should use container’s pid. Otherwise you could do the kill without docker straight from the host, in your case: sudo kill -9 … Read more

How can I diff two files with full context?

You can also override the diff formatting behavior to get your desired behavior without using side-by-side mode: diff –new-line-format=”+%L” –old-line-format=”-%L” –unchanged-line-format=” %L” file1 file2 This command will show you the full file as context and be closest in format to diff -u file1 file2

How to Sum a column in AWK? [duplicate]

The split seems unnecessary here, especially considering you’re using awk, which is made for field based processing. If your file is truly comma-separated, the following code seems much simpler, IMO: awk -F’,’ ‘{sum+=$57;} END{print sum;}’ file.txt For example, given the following input: ~$ cat testawk.txt a,a,aa,1 a,a,aa,2 d,d,dd,7 d,d,dd,9 d,dd,d,0 d,d,dd,23 d,d,dd,152 d,d,dd,7 d,d,dd,5 f2,f2,f2,5.5 … Read more

Unix find average file size

I found something here: http://vivekjain10.blogspot.com/2008/02/average-file-size-within-directory.html To calculate the average file size within a directory on a Linux system, following command can be used: ls -l | gawk ‘{sum += $5; n++;} END {print sum/n;}’

How to create special files of type socket?

The link in the accepted answer by @cidermonkey is great if you’re trying to write an app that uses sockets. If you literally just want to create one you can do it in python: ~]# python -c “import socket as s; sock = s.socket(s.AF_UNIX); sock.bind(‘/tmp/somesocket’)” ~]# ll /tmp/somesocket srwxr-xr-x. 1 root root 0 Mar 3 … Read more

Unix:merge multiple CSV files with same header by keeping the header of the first file

awk ‘FNR==1 && NR!=1{next;}{print}’ *.csv tested on solaris unix: > cat file1.csv Id,city,name ,location 1,NA,JACK,CA > > cat file2.csv ID,city,name,location 2,NY,JERRY,NY > > nawk ‘FNR==1 && NR!=1{next;}{print}’ *.csv Id,city,name ,location 1,NA,JACK,CA 2,NY,JERRY,NY > Explanation given by kevin-d: FNR is the number of lines (records) read so far in the current file. NR is the number … Read more