Easy methods to cover recordsdata and directories in Linux
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: 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 -alClick 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.Present 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
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
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.