Linux CLI References

Linux System

uname -a Print Linux system info.
cat /etc/os-release Print more Linux system info.
printenv Print all environment variables.
hostname Print the hostname of the Linux system.

Files and Directories

Make Dirs

mkdir <dir-name> Make a new directory at the current location.
mkdir --parents /some/dir/path/data/<dir-name> Make a new directory in anew deep dir structure at the current location.
mkdir --parents /some/dir/path/data/{<dir-name-1>,<dir-name-2>} Make two new directories in a new deep dir structure at the current location.
mkdir --mode=0600 --parents /some/dir/path/data/{<dir-name-1>,<dir-name-2>} Make two new directories in a new deep dir structure at the current location and give all directories read and write permissions.

Find Files and Dirs

find <top-path-to-search> -name '<file-or-dir-name>' Find all files and directories with a specific name.
find <top-path-to-search> -type f -name '<file-name>' Find all files with a specific name.
find <top-path-to-search> -type d -name '<dir-name>' Find all directories with a specific name.
find "$PWD" | sort -h List all paths in the current directory.

File Permissions

chmod +x '<the-file-name>' Make a file executable by the current user.

Users and Groups

getent passwd List all the users in the Linux system.
getent group | grep <the-username> List all groups for a user in the Linux system.
getent group List all the user groups in the Linux system.

Package Managers

apk add <package-name> Add a package to Alpine Linux.
apk add --no-cache <package-name> Add a package to Alpine Linux and do not save the downloaded files.
apk list -i List all packages installed on Alpine Linux.
apt list --installed List all packages installed on Debian Linux.
cpanm --no-wget <package-name> Install a new package with CPAN.