From Danleff Wiki
(Redirected from Linuxcommands)
- 7 Linux sudo Command Tips and Tricks
- To provide sudo access to a user, add the following line to the /etc/sudoers file.
username ALL=(ALL) ALL
- To provide sudo access to a group, add the following line to the /etc/sudoers file.
%programmers ALL=(ALL) ALL
- Remove a directory, even if files existed in that directory.
- rm -r directory
- add -f switch to prevent warning prompts.
- rm -rf dir – force remove directory dir *
- tar xzf file.tar.gz – extract a tar using Gzip
- tar xf file.tar – extract the files from file.tar
- tar xjf file.tar.bz2 – extract a tar using Bzip2
- chmod 777 – read, write, execute for all
- chmod 755 - wide open for user, read and executable for everyone else
- chmod 644 - read and writable for user, readable by everyone else
- numerical meanings
- 7 = 4+2+1 (read/write/execute)
- 6 = 4+2 (read/write)
- 5 = 4+1 (read/execute)
- 4 = 4 (read)
- 3 = 2+1 (write/execute)
- 2 = 2 (write)
- 1 = 1 (execute)chmod 755 – rwx for owner, rx for group and world
- Apply the permission to all the files under a directory recursively
- Use option -R to change the permission recursively as shown below.
- $ chmod -R 755 directory-name/
- chown -R username /dir
- Linux.org chmod
- 7 Chmod Command Examples for Beginners
- rpm -q kernel
- yum remove <filename>
- yum list kernel-* will give you a list of installed and available packages.
- List disk space usage
- df -Th
- To list the drives and relevant partitions that are attached to your system, run:
- sudo fdisk -l