Useful Linux commands

CommandComment
$ sudo su -Get root privileges and load the root user’s environment.
$ sudo !!Repeat the last command with sudo privileges.
$ printenvPrints all environment variables.
$ ssh-copy-id remote-hostUse locally available keys to authorize logins on a remote machine.
$ journalctl -rx -p 4Displays logs in the reverse order with extra information (if available) for priority 4 (warning) or higher.
$ getenforceGet the current mode of SELinux.
$ firewall-cmd --list-allList everything added for or enabled in all policies.
$ firewall-cmd --add-service=example --permanent
$ firewall-cmd reload
Permanently add a service and reload firewall rules so permanent config become new runtime config.
$ grep -rL "example" *Search through all files, including those in subdirectories, and list the ones that do not contain the string "example".
$ git checkout -b example
$ git add .
$ git status
$ git commit
$ git push
$ git checkout main
$ git pull
$ git branch -d example
Create a new branch, add and commit changes, push to a remote repository, switch back to the main branch, pull updates, and delete the example branch.
$ dnf autoremoveRemove unnecessary packages.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *