This post is an ongoing series of Linux commands helpful for developers and sysadmins alike. I do not intend this series to be a deep-dive into each command, we will take a quick look at each command, it’s usage, an example, and some common flags you might find useful.
#1 – ls
ls -flags [target]
ls -la /var
Description: The ls commands lists all the files and folders in the target directory. If the target directory is blank, ls will list files in the current directory.
-a: include hidden files
-l: shows permissions, user:group, size, and last modified
#2 – touch
Description: The touch command creates files. There’s not much to this command, but if you want to create an empty file with as little effort as possible, touch is the way to go.
#3 – su
su command allows a user to switch to the user account in the
[user] argument. If you supply no user, the
su command switches to the root user by default.
sudo su - is an excellent way to get full root access, but beware, it can be dangerous.
#4 – find
find -option [directory]
find ~ -name "*.pem"
-name: matches files with specified filenames
-user: matches files owned by a specified user
-amin: file was accessed n minutes ago
-writable: file is writable for the current user
Description: The find command searches the starting point directory and all its subdirectories for files that match the
-option flag. The find command can search your directory by name, user, access/modified time, permission options, and much more. The find command also supports wildcards and REGEXs for even more searching beauty.
#5 – history
Description: The history command shows the last
n commands run in the shell. This command is awesome for re-running a long command you typed out by hand or copied. When you run the history command, you’ll get a numbered list of previously run commands. Enter a
! followed by the number of the command you want to run and it will run again in the shell.