Much has been said about the pleasure of using the console. This is no coincidence: it was conceived by the founding fathers of Unix . There is a strange feeling that this is the most correct way to interact with a computer.
Moreover, the same pleasant feeling arises when using hotkeys in any application, even with a graphical interface.
What's the matter?
Exotic manipulator
Trackballs were originally used for special professional applications such as radar control systems. The mouse, like an inverted trackball covered with a box, was invented in the 1980s. At that time, programmers did not quite understand why a computer needed a mouse, if the code is written in the form of machine instructions, and interaction with the mainframe occurs entirely in the console.
Fancy wheel manipulators cost around $ 400. Then came the revolutionary Apple Lisa, one of the first PCs with a graphical interface. Apple dumped - it reduced the cost of the manipulator to $ 25 and made a "sexy" design with one button. The mouse has turned from a professional accessory into a mass gadget.
Apple Lisa. A very elegant design for its time
Since then, the mouse and GUI have become firmly associated with Apple computers and the fashionable windowed interface.
Windows soon came along. Then the first games with mouse support, for example, for more precise character movement ... It seems that computer games have constantly stimulated technological progress, including CPU performance, GPU performance, storage capacity, popularity of mice and other exotic manipulators.
Gamers are always dissatisfied with the current performance of personal computers and are constantly demanding the industry to increase the power of the hardware. If you look at who collects the most productive PC configurations and buys the most powerful versions of desktop processors, there will be hundreds of fans of record FPS, a couple of machine learning scientists and one programmer who builds and compiles something every day. And even then, the last three characters need a computer specifically for work, so they do not always invest their own money, like gamers.
If not for computer games, then processor manufacturers could focus solely on server CPUs. Indeed, an army of accountants, economists and other office clerks will sit quietly on computers 20 years ago, which they are completely satisfied with . They do not know at all what hardware is inside the "processor" (as they call the system unit). But do not take your hand off your favorite mouse. Take the mouse away from the office clerk - and he will stare blankly at the monitor for several minutes and uselessly twitch his hand, unable to perform a single useful action, as if under sedatives.
Nowadays, it's rare to find a computer without a mouse. But the pleasure of working in the console remains.
On forums and blogs, Linux users share their favorite one-liners and other tricks to improve their workflow efficiency. There's even a great one-liner voting site ...
Cool one-liners
Here are some examples of interesting uses for Linux programs.
ps aux | convert label:@- process.png
The command converts the output from the console to an image. For example, to share with colleagues as a screenshot. The very idea of taking a screenshot of the text seems conceptually wrong to some, but in some cases it's just faster and more convenient. Nowadays, with the proliferation of smartphones and tablets, screenshots are becoming almost the standard for copying text from the screen, which is a little sad if you take it as a hint of the decline of universal computers ...
Note. The utility
convert
is included in the ImageMagick package , so you need to install it first.
In general, text from the console can be quickly posted via an Internet service like termbin.com (it's like pastebin, just for the console):
ps aux | nc termbin.com 9999
As usual, with an alias for frequent use:
alias tb='nc termbin.com 9999'
Next:
curl ipinfo.io
This is if you want to find out your external IP address through the ipinfo.io service .
git log --format='%aN' | sort -u
A very handy team if you are working on an open source project and want to see the contributors.
history | awk '{print $2}' | sort | uniq -c | sort -rn | head
A sorted list of the most frequently run commands (it is also useful to add to aliases to run in a couple of clicks).
ls -d */
Listing only directories. A useful command that would also be nice to assign an alias for quick use.
du -hs */ | sort -hr | head
This command only shows the 10 largest directories in the current directory.
ss -p
View which applications are consuming traffic (utilities
iftop
and
nethogs
give more details).
rm -f !(test.txt)
The command removes all files from the directory, except for the one specified in parentheses. This works after enabling extended globulation in bash (
shopt -s extglob
).
python3 -m http.server
Launches the http server and starts serving files. Convenient if you want to browse some html file over the network.
screen -S the-screen-name
Creation of a screen session.
screen -x the-screen-name
Connecting to a screen session. Such a session can be forcibly created for the user after his authorization in the system - and watch what is happening on his screen. Useful if someone has connected to your server and you want to see what they are up to.
The utility
screen
comes by default with many Linux distributions, though not all.
alias copy='xclip -i -selection clipboard'
cat file.txt | copy
Copying a file to the clipboard when the first one-liner is registered as an alias
copy
in the bash.
sudo !!
Run the last command under the root, if you forgot to type in the previous command
sudo
. This team has the first place in the ranking of one-liners .
Of course, these are just examples. The beauty of the Linux console is that you can come up with a sequence of commands yourself that no one has ever used, but you need this particular pipeline in this situation.
Keyboard shortcuts as a legacy of the console
In graphic programs for Windows, you also often want to do the work with hot keys, without touching this "Apple" manipulator. In fact, using hotkeys greatly speeds up the workflow in any program.
Bash aliases serve the same purpose: execute the command with the least amount of effort, that is, with the fewest keystrokes.
An experienced technician interacts with the machine almost at the speed of light. The speed is limited only by the processing time of commands on the CPU and the speed of text output to the console, that is, by the speed of the graphics subsystem. And with network latencies, the computer is slower than the human . This is the ideal of human performance.
If we rise to a higher level of abstraction, then hotkeys in graphical interfaces are, in a sense, a distant descendant of the console, a kind of historical "echo". With hot keys, one-liners and aliases in the bash, a person becomes "faster than a computer" - you have to pause to wait for the result of command execution. The CPU is almost 100% loaded.
This is a fundamental advantage of the keyboard as a command entry tool over any keypad. This is also the strength of the console.
Of course, not all commands are hotkeys. Sometimes you need to move a graphic object on the screen ... Then you need a cursor. But if the hotkey exists, it is without options faster than the analogous mouse action in the menu. Hotkeys are living proof that keyboard commands run faster.
In general, this fact may lead to the assumption that the founding fathers of Unix were right after all, and their legacy lives on in all operating systems . The GUI is just a thin layer of abstraction on top of the powerful foundation they've built. After all, we remember that macOS is also based on Unix and belongs to the family of * nix systems.
But windows and other elements of the Windows graphical interface, according to Apple, are a secondary product copied from the Lisa interface (see Apple v. Microsoft lawsuit from 1988 to 1994 ).
The court dismissed Apple's claim against Microsoft. But some things draw attention to themselves. For example, a command
open .
in the macOS console opens the Finder in the current directory. On Windows, the command does the same
start .
(Finder is called Explorer here). Windows in macOS are closed with a cross in the upper left corner, and in Windows - in the right corner. Perhaps, by the example of such details, Bill Gates proved to the court that he has an “original” graphical interface that is “very different” from macOS.
Whether the graphical interface was copied or not is formally unknown. But the fact is, it's just a thin shell over the system. Just like a mouse, it is a convenient, but not at all necessary accessory.
Advertising
Our company offers VPS rental for absolutely any project. Create your own tariff plan in a couple of clicks, the maximum configuration will allow you to accommodate almost any project - 128 CPU cores, 512 GB RAM, 4000 GB NVMe!
Join our Telegram chat .