Humans make mistakes because we are not a programmable device, so be careful when using the rm command, don't use rm -rf * at any time. When you use the rm command, it permanently deletes files and does not move them to the Trash Can like the file manager does.
Sometimes we will delete files that should not be deleted, so what should we do when the files are deleted by mistake? You have to look at the recovery tool (there are a lot of data recovery tools in Linux), but we don't know if it can be recovered 100%, so how can we solve this problem?
We recently published an article about Trash-Cli. In the comments section, we got an update from user Eemil Lgz about the saferm.sh script, which helps us move files to the "trash bin" instead of permanently deleting them. they.
Moving a file to the "trash can" is a good idea to save you when you accidentally run the rm command; but few people will say it is a bad habit, if you don't pay attention to the "trash can", it might Stacked up files and folders for a certain amount of time. In this case, I suggest that you do a scheduled task as you wish.
This applies to both server and desktop environments. If the script detects a GNOME, KDE, Unity, or LXDE desktop environment (DE), it will safely move the file or folder to the default trash $HOME/.local/share/Trash/files, otherwise it will be in your home directory Create a trash can folder $HOME/Trash.
The saferm.sh script is hosted on Github and can be cloned from the repository, or it can create a file called saferm.sh and copy the code on it.
$git clonehttps://github.com/lagerspetz/linux-stuff
$sudo mv linux-stuff/scripts/saferm.sh /bin
$rm -Rf linux-stuff
Set an alias in the .bashrc file,
Alias ​​rm=saferm.sh
Execute the following command to make it effective.
$source ~/.bashrc
Everything is ready, now you can execute the rm command to automatically move files to the "trash can" instead of permanently deleting them.
Test it out, we will delete a file named magi.txt, and the command line explicitly reminds Moving magi.txt to $HOME/.local/share/Trash/file.
$rm -rf magi.txt
Moving magi.txt to /home/magi/.local/share/Trash/files
It can also be verified with the ls command or trash-cli.
$ls -lh /home/magi/.local/share/Trash/files
Permissions Size User Date Modified Name
.rw-r--r-- 32magi11Oct16:24magi.txt
Or we can view the same content through the file manager interface.
(LCTT Annotation: The original text here confuses the contents of some trash-cli, considering the article connection and logic, here is a little.)
To learn about other options for saferm.sh, check out the help.
$saferm.sh -h
Thisissaferm.sh1.16.LXDE andGnome3 detection.
Will ask tounsafe-delete instead of cross-fs move.Allows unsafe(regular rm)delete(ignores trashinfo).
Creates trash andtrashinfo directories ifthey donotexist.Handles symbolic link deletion.
Does notcomplain about different user any more.
Usage: /path/to/saferm.sh[OPTIONS][--]files anddirs tosafely remove
OPTIONS:
-r allows recursively removing directories.
-f Allow deleting special files(devices,...).
-u Unsafe mode,bypass trash anddelete files permanently.
-v Verbose, prints more messages.Defaultinthisversion.
-q Quiet mode.Opposite of verbose.
A communication Cable Assembly is a Wire Harness used to transmit signals. A communication cable consists of a plurality of mutually insulated wires or conductors to form a cable core, with a communication line with a sealing sheath on the outside. Some are also equipped with an outer sheath outside the sheath. There are various laying methods such as overhead, direct burial, pipeline and underwater. According to the structure, it is divided into symmetrical, coaxial and integrated cables; according to functions, it is divided into field and permanent cables (underground and submarine cables). The communication cable has a wider transmission frequency band, a larger communication capacity, and less external interference, but it is not easy to repair. It can transmit phone calls, telegrams, data and images, etc.
Communication cable assembly can be classified mainly by cable types and applications
According to the type of cable, communication cables are classified as follows:
1. Single-conductor: refers to the most primitive communication cable, a single-conductor loop, with the earth as the regression line.
2. Symmetrical cable: a loop composed of two identical conductors under ideal conditions.
3. Coaxial cable: The inner and outer conductors on the same axis form a loop, the outer conductor surrounds the inner conductor, and the two are insulated at the same time.
Then they are classified according to the application as follows:
1. Long-distance cable: The transmission distance is long, and it is generally multiplexed. Most of them are directly buried in the ground. In a few cases, they are installed overhead or installed in pipelines.
2. Cables in the city: the wires in the cable are "paired and paired", and the number of pairs is large. Generally installed in the pipeline, a small number of urban cables are attached to the building or installed overhead.
3. Office cable: mainly refers to the communication cable used in the telecommunications office, generally installed on the distribution frame, and some are installed in the wiring trough; the office cable is used between the transmission equipment and the switching equipment in the telecommunications office, and other Inside of intra-office equipment. In order to prevent fire inside the telecommunication bureau, it is sometimes necessary to add a flame retardant sheath to the bureau cable.
Communication Cable Assembly,Wiring Harness Tools,Wire Harness Tape Wrapping Machine,Wire Harness Machines
Kable-X Technology (Suzhou) Co., Ltd , https://www.kable-x-tech.com