Supposed to see '~' when listing file in directory

I'm working on a assignment for school and I'm having an issue getting this portion to work properly.

The assignment is having me create a file in the CLI, open and edit the file in GEDIT without saving, then list the directory. According to the instructions, when I list the directory, the file I have open and appended but unsaved should display a '~' after it but it's not showing up.

Am I missing something?


Yes, you miss something: you do not expect to see that file when you first open it. You only will see it after you saved the file you opened.

How does gedit save files

The current file is renamed. Then the modified content is written out to a new file that is being given the name of the file you opened.

If in "Preferences", "Editor" tab, the option "Create a backup copy of file before saving" is enabled, the backup file is renamed by adding a ~ to the file name. Else, it is renamed to a random string starting with a dot .. That randomly named file is deleted if the save is successfull.

Contrast with behaviour of other, typical terminal based editors

This behaviour of the graphical editor Gedit (and other graphical editors) affects the working of hard links. As explained above, these editors actually save your modified content under a new file, i.e., a new inode. Linux hardlinks point to an inode. A hardlink to the same file elsewhere on the file system will continue to point to to the old data, and not anymore be linked to the changed file. Usually, this is not what users expect. However, this approach is safer: if the save fails, the original content is still preserved on disk.

Traditional (in particular terminal based) linux editors will save the updated content to the same inode. They write out the updated contents to the same inode, replacing the old content.