I have managed to write a piece of code in .profile file in bash to hide/show all the icons from the Desktop, running from Terminal.

I need the same functionality just for 1 icon to work with after I have hidden all in the first place.

So I need something like showicon %1 command, where %1 is the name of the icon on Desktop.

Any Suggestions on how do I do it?


1 Answer 1


The Terminal command chflags can be used to hide and unhide files:

    chflags hidden /path/to/file.ext


    chflags nohidden /path/to/file.ext

You can create a simple alias called hideicon that invokes chflags hidden, and similarly for showicon to invoke the opposite command:

    alias hideicon='chflags hidden'


    alias showicon='chflags nohidden'

Add these to your ~/.bashrc file, and they'll load with each new instance of your shell.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .