Helpful Linux Commands
User Administration
- adduser <username>: Create a new user named <username>
- userdel -r <username>: Delete the user named <username>. The -r option removes the user's home folder located at /home/<username>.
- lastlog: lists all users and the last time that they logged in.
- groupadd <groupname>: Create a group called <groupname>
- useradd -G <groupname1>,<groupname2>... <username>: Add a user named <username> to a group or multiple groups.
Permissions
- chown <username>:<groupname> <file or directory>: Change the owner of at file or directory to <username> and <groupname>.
- chmod <permissions code> <file or directory>: Change the permissions on a file or directory to that specified.
"Hardware" Resources
- top: Show the top resource using processes
- ps aux: Show all processes
- free: Show information about memory allocation
- du <file or folder name>: Show the size of a file or folder, recursive for folders.
- kill <PID>: Kill a process by its ID. Use kill <PID> -9 to force the kill.
EC2 Tools
- ec2-bundle-vol: use to bundle an AMI for your running instance. Use --help for syntax information.
- ec2-upload-bundle: use to upload your bundle to Amazon's place for these things. Again, Use --help for syntax information.
Package Management / Software Installation
- apt-get: Oh my goodness its so easy to install anything!
- dpkg -L <package name>: Show a list of all the files that were installed with the named package. Useful since Linux seems so silly about where everything ends up...
Debugging
- tail -f <log file>: Real-time display of latest log file changes.
- find / -name <file or folder name fragment>*: Recursively search for folders and files by partial name from root down.