Linux Tutorials

Easy methods to cover recordsdata and directories in Linux

SEOClerks

I am a brand new Linux consumer. How do I cover recordsdata and directories in Linux working methods utilizing the command line interface?

Introduction – In Linux and Unix-like methods, if a file or listing (folder) title begins with a interval (.), then the file turns into hidden by default. To see all hidden recordsdata in Linux run ls -al command. This web page reveals easy methods to cover recordsdata in Linux utilizing numerous strategies.

What’s the distinction between a hidden file and an extraordinary file in Linux?

The principle distinction between a hidden file and an extraordinary file is that the file title of a hidden file begins with a interval or dot (.). Usually generally known as dot recordsdata in Linux. The dot file will not be a safety characteristic. It’s on your comfort and to cut back muddle in your house listing.

Easy methods to view hidden recordsdata in Linux

You may cross the -a choices to the ls command to see hidden file:
ls -a
ls -al
ls -al | extra
ls -al | grep ‘bash’
Linux / Unix: Find And List All Hidden Files RecursivelyLinux / Unix: Discover And Checklist All Hidden Information Recursively

How do I cover recordsdata and directories in Linux?

To cover a file or listing in Linux, rename it with a interval (.) initially of its title utilizing the mv command. Say, it is advisable to cover a file named foo.txt, run:
mv foo.txt .foo.txt
Confirm by working the ls command:
ls
ls -al

Allow us to create a brand new file in Linux named foo.txt for demo function

$ echo “Isolation does not hassle me in any respect. It provides me a way of safety.”> foo.txt
$ ls
$ mv foo.txt .foo.txt
$ ls
$ ls -al
How to hide files and directories in Linux using a periodClick on to enlarge

Look ma recordsdata are hidden in GUI file managers too

Open folder or directories in your GUI file supervisor. Press CTRL+H to see or cover hidden recordsdata together with common recordsdata.
Show all hidden files in GUIPresent or cover all hidden recordsdata by urgent CTRL+H in Linux

How do I cover folders/directories in Linux?

Use the mv command by including a . at first of the listing title:
mv -v my-folder .my-folder
mv -v dir1 .dir1
mv -v dir2 .newdir2

How do I unhide a file or folder in Linux?

To unhide a file referred to as .foo.txt, rename it to foo.txt i.e. take away a dot/interval . at first of its title:
ls -la
mv -v .foo.txt foo.txt
mv -v .dir1 dir1
mv -v .newdir2 dir2
ls -l

Easy methods to cover and password defend my recordsdata

To encrypt a single file, use the gpg command as follows:
gpg -c foo.txt
Now cover it:
mv -v foo.txt.gpg .foo.txt.gpg
Delete the unique file in Linux utilizing the rm command:
rm foo.txt
ls -la
Hide file and secure with a password using gpg in Linux
To decrypt file use the gpg command once more as observe:
gpg –output foo.txt –decrypt .foo.txt.gpg
rm .foo.txt.gpg
For extra info see my put up “Linux Encrypt And Decrypt Information With A Password“.

Easy methods to compress and defend a folder in Linux utilizing a password

Use the tar command to compress the entire folder named dir1 within the present working listing:
tar -cz dir1 | openssl enc -aes-256-cbc -e > dir1.tar.gz.enc
Cover it:
mv -v dir1.tar.gz.enc .dir1.tar.gz.enc
Delete the unique listing in Linux utilizing the rm command:
rm -rf dir1
To decrypt, run:
openssl enc -aes-256-cbc -d -in dir1.tar.gz.enc | tar xz
Hide and Compress directories with a password in Linux

Associated – How do I Compress a Complete Linux or UNIX Listing?

Conclusion

This web page demonstrated numerous methods to cover and use a password to guard recordsdata in Linux.

Posted by: Vivek Gite

The creator is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a coach for the Linux working system/Unix shell scripting. Get the newest tutorials on SysAdmin, Linux/Unix and open supply subjects by way of RSS/XML feed or weekly e-mail publication.

Source link

Related Articles

Back to top button