Linux utils that you might not know
shiroyasha.io
Linux utils that you might not know
1–10 of 159 posts
Re: Linux utils that you might not know
#2Re: Linux utils that you might not know
#3As much as people make fun of him for caring so much about a seemingly minor point, I've come around to understanding RMS's frustration about people calling all of the GNU project "Linux". This sort of title drives home why: neither Linus nor anyone else on the Linux project had anything to do with any of this.
Re: Linux utils that you might not know
#4Example: Created two files (1.txt and 2.txt)
[efg@fedori ~]$ cat 1.txt
file1: line1
file1: line2
[efg@fedori ~]$ cat 2.txt
file2: line1
file2: line2
In order to merge the lines of these two files we can use paste:
[efg@fedori ~]$ paste 1.txt 2.txt
file1: line1 file2: line1
file1: line2 file2: line2
Also check out 'man fold'
Re: Linux utils that you might not know
#5As much as people make fun of him for caring so much about a seemingly minor point, I've come around to understanding RMS's frustration about people calling all of the GNU project "Linux". This sort of title drives home why: neither Linus nor anyone else on the Linux project had anything to do with any of this.
Re: Linux utils that you might not know
#6As much as people make fun of him for caring so much about a seemingly minor point, I've come around to understanding RMS's frustration about people calling all of the GNU project "Linux". This sort of title drives home why: neither Linus nor anyone else on the Linux project had anything to do with any of this.
Re: Linux utils that you might not know
#7Re: Linux utils that you might not know
#8* Newer versions of sort have an option for running sorts in parallel. If you're using an older sort, you can split the files, sort them individually with GNU parallel, and use --merge to combine them.
* If you have scripts that read data files, process them, and output more files, consider using a Makefile.
* tmux is a good way to leave a development session on a server that you come back to at the start of the day, or that you run long-running processes in.
* Setting a soft ulimit system-wide is a good way to avoid accidentally running the machine out of memory, causing your C libraries to be paged out to disk, and usually requiring a reboot. Since it's soft, you can override it at any time.
* strace and gdb can be run on just about anything to see what it's doing. If it's an interpreted language, you can often attach to a live process, call a function to invoke some interpreted code, and not have to kill & restart the process to fix a bug or oversight. Or you can attach to a Postgres worker process to get a stack trace, which often tells you why your query is slow if it runs so long you can't get an explain analyze.
* Look in /proc to find tons of useful information about running processes and settings. For example, you can tell how many filehandles a process has open, and sometimes what file it corresponds to. Just yesterday, a grub update caused a server to boot the kernel with the command line replaced with 2 random characters and a newline, which would be harder to debug without /proc/cmdline.
* pushd and popd are useful in shell scripts to temporarily change directories without forgetting where you were.