Forget your bird, Love Linux
Click on playground and roll on your sleeves :c) -
playground
There are four types of the shell, we have ...
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
When a file size increasing overtime, use
truncate
, but without changing anything to the file permission and other stuff that applied to it. Best with adding it tocrontab
.-s
is set limit file size e.g. 1024kUnfortunately, this shortens the end of the file, which reduces its usability.
Luckily, you can set limit the file size.
When logging in, I am not interested in the beginning of the file, but mainly its end. Every time I cut it off, logging loses its meaning.
You are right. For user does not care about the logging but just want to reduce the file size (a couple of gigabytes). This is useful.
Pro Tip: never use
rm -r directory/
You will get used to it, and one day you will use env-vars and use
rm -r $someDir
That is when bad things can happen. Especially if $someDir ends up being / for some reason.
If you delete something recursively, be precise. If you want to prevent deleting any important directory, there is a neat trick.
Get used to
rm -r directory/* && rmdir directory/
andcreate a file named -i in all directories you want to protect. This can be done using
touch -- -i
or
touch ./-i
The * in
rm -r directory/*
will expand the -i File to the command line, so your command ultimately becomesrm -rf -i
Thus rm will prompt you before deleting anything. You can put this file in your /, /home/, /etc/, and so on.
what if you simply alias
rm
with a "trash" tool that puts stuff in your desktop Trash can?Or in alternative, alias
rm
withrm -i
?That could be a solution. I never really used "~/.local/share/Trash/" before.
rm in linux means "it's gone for good now". I'm not sure if rm has a "soft delete" or anything of the likes. The only thing to revert a rm is to restore a backup afaik.
I'm not a fan of aliasing rm, since aliases are user-only and if you don't keep your alias file portable on you for every system, through git or whatever, you rely on it on the wrong machine, and your stuff is gone.
rm should always be used with caution.
I don't use Linux but in macOS terminal I have the following alias in my
.zshrc
:where
trash
is hasseg.org/trash/Never been happier :D
That's a cool little utility for my mac! I'll be sure to try that one, thanks! :)
thank you pal..that was helpful :)
Gladly! I hope you will continue to enjoy linux and it's powerful terminal even more in the future :D
rm doesn't let you delete root anymore.
They fixed that, check the manpage.
That doesn't mean that a cleaned out /etc/ or any other system-critical directory won't hurt you a lot. Sure, you can't "kill" a linux box with RM anymore, but you can still make it pretty damn unusable
Isn't that what good permissions, not running as root by default, and backups, are all for?
Considering we are discussing this in a beginners post about Linux, the foundation of careful usage should still apply.
Other than that, yes you are certainly right. A beginner probably doesn't have these precautions in place though.
Wait a minute...!! i just saw title and thought.., it might be your story about linux. but it has totally different. 🤣🤣🤣🤣🤣. i think you title should be "basic linux command which developers user everyday."
Yeah!! Agree, I can write that too; however, this my post I can write whatever I want. There are many commands in this post which I don't use on daily basis.
:c)
Click bait. And I think he is right. But you are right, too. It will however not help you grow your views with that attitude. Think about it. ;-)
I am also in love with terminal bro , It's really power to master it , even if it take some times. if every one here new and got scared try to move slowly from GUI to terminal (CLI) , maybe your not going to feel the power only after a time of learning terminal shortcuts.
Good list! Missing some grepping :)
find
command is useful and I usually use it every workdays :).Helpful 👍👍👍
I think you meant
And great post I'm also a termlover :D
Great pick, thank you for correcting!! :)
"I am love with terminal" - makes no sense
Nice list. And I agree, the Linux shell is very nice and powerful. One of the reasons why I like using Linux :)
Really very helpful as it includes all the basic commands that requires for the terminal. Thank you for collaborating in one place.
man <command>
or
<command> --help
Great work as the content is very clear and easy to grasp, though the file is not downloadable from both of the given links as it shows a 404 error.