Posted: . At: 9:09 AM. This was 4 years ago. Post ID: 13957
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to get a nice DOS styled shell prompt for fun in Linux.


This PS1 example gives the user a pretend DOS shell prompt. This is very interesting and would be fun to play with for an experienced user, or to complete a Windows themed desktop environment like Cinnamon. That can be made to look just like Windows 10. And with this shell prompt, it could emulate the Windows CMD prompt very well.

PROMPT_COMMAND='export PWD_UPCASE="${PWD^^}"'
PS1='C:${PWD_UPCASE//\\//\\\\}> '

This is what it will look like.

C:\HOME\JASON>

This is a very interesting trick, this would really be a fun way to spice up a Linux desktop. I tried it on a Mac with bash and it did not work, but it works fine on Linux.

How to delete a file named “-f”. This would be very frustrating indeed. But it can be done.

Use this command and it will be deleted.

rm -- -f

or you can use the ls -ihula command to list all the files and as well as the inode numbers.

C:\HOME\JASON\DESKTOP\TESTING> ls -iuhla
total 16K
  925758 drwxr-xr-x  2 jason jason 4.0K Jan 10 08:55  .
14811147 drwxr-xr-x 16 jason jason 4.0K Jan 10 08:48  ..
  925801 -rw-r--r--  1 jason jason    1 Jan 10 08:55 'f'$'\b\003'
  925779 -rw-r--r--  1 jason jason    0 Jan 10 08:49  -rf
  925798 -rw-r--r--  1 jason jason    0 Jan 10 08:49 'rm -rf'
  925816 -rw-r--r--  1 jason jason   16 Jan 10 08:55  tst.sh

Then delete the file by inode number.

C:\HOME\JASON\DESKTOP\TESTING> find . -inum 925801 -exec rm -i {} \;
rm: remove regular file './f'$'\b\003'? y

That is how to delete a hard to delete file on Linux.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.