Can you create hidden files with other commands?

QuestionsQuestions8 SkillsProDec, 22 2025
0108

Yes, you can create hidden files with almost any command that outputs or saves data to a file. The key is always the filename starting with a dot (.).

Here are a few common ways to create hidden files using different commands:

1. Using echo or printf (Redirection)

You can create a hidden file and put text inside it immediately using the > operator:

echo "This is a secret" > .secret_note.txt

2. Using Text Editors (nano or vi)

You can start an editor and save the file with a dot prefix:

nano .config_file

(After typing your content, press Ctrl+O and Enter to save, then Ctrl+X to exit.)

3. Using mkdir (Hidden Directories)

The "hidden" rule applies to folders (directories) too. Just start the folder name with a dot:

mkdir .hidden_folder

You won't see this folder with ls, but you will see it with ls -a.

4. Using cp (Copying)

You can copy an existing regular file to a new hidden location:

cp project .project_backup

Summary

In Linux, the "hidden" status is not a special file attribute or permission—it is purely based on the name. If it starts with ., tools like ls and file managers will hide it by default unless you specifically ask to see "all files."

0 Comments

no data
Be the first to share your comment!