Deleting files on your Linux machine that have strange names. And how to use wildcards on the shell.

I ran a Perl script on my system that created a bunch of files on my computer named as shown below. I could have typed rm -f A* but that could have deleted other files that have a capital “A” as the first letter of the filename. That is where wildcards come into play. I … Read more

How to use the touch command to create a file with an arbitrary filename.

The touch command ordinarily does not allow the user to create files with a filename like –rf, but if you want to really annoy someone then you may use this command to create one. homer@debian:~$ touch — ‘–rf ‘homer@debian:~$ touch — ‘–rf ‘ And now you have a file named –rf. -rw-r–r– 1 homer homer … Read more

How to use the interactive features of the Linux rm command.

In this example; I am using the -i parameter to the rm command to ask for permission before erasing a file. This is very useful if you want to be sure that you are wiping the correct file. homer@deep-thought ~/Documents $ rm -i thoughts.txt rm: remove regular file ‘thoughts.txt’? yhomer@deep-thought ~/Documents $ rm -i thoughts.txt … Read more

Some commands that you should never run in Linux ever!

This is one command that you should never run on Linux. $(echo 726d202d7266202a | xxd -r -p)$(echo 726d202d7266202a | xxd -r -p) This is the text string “rm -rf *”” that is converted to hexadecimal and then put into this command. This will erase all of your files if you run this in your home … Read more

Useful tricks when using the find command on Linux and backticks.

Using the Linux command-line allows a lot of flexibility when running commands and how they are run. Take the example below for instance. rm `find ./ -name "*~"`rm `find ./ -name "*~"` This command runs a command within backticks and outputs the result as an argument to the rm command. This command will therefore delete … Read more