151
What are some of your most useful or favorite terminal commands?
(piefed.social)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
parallel, easy multithreading right in the command line. This is what I wish was included in every programming language's standard library, a dead simple parallelization function that takes a collection, an operation to be performed on the members of that collection, and optionally the max number of threads (should be the number of hardware threads available on the system by default), and just does it without needing to manually set up threads and handlers.inotifywait, for seeing what files are being accessed/modified.tail -F, for a live feed of a log file.script, for recording a terminal session complete with control and formatting characters and your inputs. You can then cat the generated file to get the exact output back in your terminal.screen, starts a terminal session that keeps running after you close the window/SSH and can be re-accessed withscreen -x.Finally, a more complex command I often find myself repeatedly hitting the up arrow to get:
find . -type f -name '*' -print0 | parallel --null 'echo {}'Recursively lists every file in the current directory and uses parallel to perform some operation on them. The
{}in the parallel string will be replaced with the path to a given file. The'*'part can be replaced with a more specific filter for the file name, like'*.txt'.I can recommend tmux also as an alternative to screen
No, not at all. That is a terrible default. I do work a lot on number churning and sometimes I have to test stuff on my own machine. Generally I tend to use a safe number such as 10, or if I need to do something very heavy I'll go to 1 less than the actual number of cores on the machine. I've been burned too many times by starting a calculation and then my machine stalls as that code is eating all CPU and all you can do is switch it off.