You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1.7 KiB

Strange Files

We come across files and folders name very regularly. In most of the cases file/folder names are related to the content of the file/folder and starts with numbers or letters. Alpha-Numeric file name are pretty common and very widely used, but this is not the case when we have to deal with file/folder name that has special characters in them.

Example of most common file names are:

something.txt
alphanum21.txt
674659.txt

Examples of file names that have special characters:

#121day.txt
some/file#.txt
*File$*.txt

When You create a file with some special character, you will need to escape those special characters in order to create that file.

A non-quoted backslash \ is the escape character. The backslash \ preceding a character tells the shell to interpret that special character literally.

Example:

If you want to create a file named foo!\.txt You have to escape the characters like so:

$ touch foo\!\\.txt

Instructions

Create a file the following files:

  • firstFile which contains Random text inside! and nothing else
  • "medium_File!" which contains Random text inside! and nothing else
  • "\?$*'Hard_file'*$?\" which contains Random text inside! and nothing else.

Usage

$ ls | cat -e
"?$*'First_file'*$?\"$
firstFile$
"medium_file!"$
$

Hints

  • ls. List directory contents.
  • touch used to create, change and modify timestamps of a file.

You have to use Man or Google to know more about commands flags, in order to solve this exercise! Google and Man will be your friends!

References