Here are some CLI commands that I've discovered, collected, or given that has helped me over the years... Please fee free to add to it.
Creating an User Account
- useradd [username]
- passwd [username]
Changing User's Password
- passwd <username>
Granting Someone Temporary Root Access (Like a support person)
Using the SUDO (Super User Doer) command.
- Login as root user.
- cd /etc
- nano sudoers
- Scroll down to the section of the file called...
- ## Allow root to run any commands anywhere
root ALL=(ALL) ALL - Add the following to the next line
<Username> ALL=(ALL) ALL
- Press "CTL o" to save
- Press "CTL x" to exit.
List User Accounts
- cat /etc/passwd | gawk 'FS=":" {print $1}'
Lock and Unlock a User Account
- passwd <username> -l
- passwd <username> -u
Shutdown Server
- Linux: Shutdown -P now (to power the server off after shutdown)
- Linux: shutdown –r now (to restart the server after shutdown)
Editing Files
- Edit a File: Vi /path/to/file
- Press “i” to enter in “Insert Mode (To leave “Insert Mode” press “esc”)
- Delete a character currently under the cursor you must press “x” (you must NOT be in “Insert Mode” because you will insert the letter “x”)
- To save (not in “Insert Mode”) press “:x”
- If you don’t want to save but want to quit, press “:q” (not in “Insert Mode”)
- To search within a file
To search forward, use “/” and then the word
To search backward, use “/” and then the word
Show Who Last Logged into the Console and How Long
- last
Run a Manual Backup
1. Log into the AWMS system as root.
2. Run the backup script by typing 'amp_backup'.
This creates a backup of the system located in /alternative/databackup.tar.gz.
A good open source Windows file transfer client that supports SFTP and SCP for is WinSCP which is available from http://winscp.sourceforge.net/eng/. WINSCP allows you to transfer the databackup.tar.gz file from your AWMS to your local PC using the secure copy protocol (SCP).