Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Something you may not know about the Linux system

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you some things you may not know about the Linux system, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

Linux is a free-to-use and free-spread Unix-like operating system. It is a multi-user, multi-task, multi-threaded and multi-CPU operating system based on POSIX and UNIX. It runs major UNIX tools, applications, and network protocols. It supports 32 bit and 64 bit hardware. Linux inherits the design idea of Unix with network as the core, and is a multi-user network operating system with stable performance.

One of the coolest parts of using Linux is to constantly acquire new knowledge over time. Every day, you may come across a new utility, or an unfamiliar logo, and you can do something useful. These little details may not always change lives, but they are the cornerstones of expertise.

Even the experts don't know all this. No matter how much experience you have, there will always be more to learn, so here are seven things you may not know about Linux.

History commands have interactive mode

You may be familiar with the command history (history) of the Linux system, which provides a standard list of bash input commands. However, if you look for a specific URL in many "curl" commands, you will find this list not very easy to use.

Instead, Linux provides an interactive reflection search function to help you deal with the above annoyance. You can press the "Crtl+r" key to activate the command history query function, you can enter the command content interactively, and press the "Crtl+r" key to cycle through the command history that contains the input. When you find it, you can press the enter key to execute it again, or you can use the direction key to select it, and the command will be entered again, waiting for execution.

Cron is not the only way to schedule tasks

The cron command is extremely useful for task-level users, whether beginners or experienced experts, can use this command to make task plans for system execution. But if you only set a task once, then the "at" command allows you to achieve your goal without touching the crontab table.

Enter "at" at the command prompt and follow the scheduled execution time of the task. The command supports a variety of time formats, such as specific execution time and delayed time nodes. Here are some specific examples:

"at 12:00 PM September 30 2017"

"at now + 1 hour"

"at 9:00 AM tomorrow"

When the input is complete, you can enter the tasks you want to perform. After all the task input is completed, start another line, and then press "Ctrl+D" and then display "EOF" to indicate that the input is complete. Now you have completed the setting of a task schedule. Further, you can use the "atq" command to query the list of tasks that you have not executed, or you can use "atrm" plus the task number to cancel the task plan.

You can find commands by function, not just by command name

It can be difficult to remember each command name, especially for beginners. Fortunately, Linux comes with a man tool that searches through function descriptions and command names. Next time, if you have difficulty remembering the name of the command you want to use, you can try to find the command you want with an appropriate description. For example, establishing a file system returns a list of names and description tools, including "biuld" or "filesystem". Now, you can type "man build filesystem", and the man tool will display the corresponding command according to your input.

Man takes one or more strings as arguments, but it also has the option-R, which allows you to search through regular expressions.

An alternative system allows you to manage versions

If you have ever been involved in software development, then you will know the importance of cross-project version management. Many Linux distributions have tools to handle different built-in versions.

Executables, like java, are often symbolically linked to / etc/alternative. This directory, in turn, is symbolic links to store binaries and provide interfaces for managing these links. Java is the most commonly used language replacement, but with a little configuration, it can also be used as an application like NVM and RVM replacement (such as NodeJS, Ruby).

In Debian-based systems, you can create and manage these link update solutions. In CentOS, tools are so-called substitutes. By changing the links in the alternative files, you can install multiple language versions and use different binaries in different situations. Of course, this is not limited to programming languages. The alternative system also supports any executable you might want to run from the command line.

"shred" command

Most people use the "rm" command to delete files, but do they actually delete files? In fact, the system does not do what you expect, the system will only delete the hard link between the file system and the disk file. These "0" and "1" values exist until they are overwritten by another application, which is very insecure for sensitive data.

The "shred" command is the absolute way to "rm". When you "shred" a file, the physical data of the file is randomly overwritten several times. You can even use the option to overwrite the original data after deleting the file with a string of zeros.

The command to delete the file completely and overwrite it with zero is:

Shred-u-z [file name]

You can also add an n option with a number as a parameter, which allows you to specify the number of iterations to randomly overwrite the data.

Autocorrect function to avoid errors when entering a long file path

How many times have you entered an absolute file path and got the message "there is no such file or directory"? No one wants to experience the pain of facing a long list of wrong paths, but fortunately, Linux has a simple solution.

The built-in "shopt" command allows you to set different options to change your shell behavior. Setting the cdspell option to "on" avoids the troublesome file path problems caused by a letter error. You can use the "shopt-s cdspell" command to enable this option. Once activated, the file path is automatically corrected to the nearest match when you try to enter the directory.

The shell option is a great way to save time (not to mention trouble), and there are many other options. To see a complete list of shell options, you can run shopt without arguments. You know, this is a feature of bash, so if you are using another shell, you may not be able to use this command.

Quickly return to the current directory

If you have configured a moderately complex system, you may find yourself changing directories frequently, making it difficult to track your location. Wouldn't it be nice to automatically return to the current location after running the command?

Linux actually provides a solution to this problem, which is very simple. If you go into another directory to do something and then return to the current working directory, enclose the command in parentheses. Here is an example where you can test it yourself. Make a note of your current directory, and then run:

(cd / etc & & ls-a)

This will display the contents of the / etc/ directory instead of your current directory.

These are all the contents of this article entitled "some things you may not know in Linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report