Here's a list of the most common ones:
Add a user:
adduser john
Set the password for a user:
passwd john
Show the current directory:
pwd
Create the home directory for a user:
mkhomedir_helper john
Clear the screen:
clear
List a directory, including hidden files:
ls -a
List a directory, with detailed info:
ls -l
Create an empty file:
touch myfile.txt
Create a directory:
mkdir mydir
Copy a file
cp myfile.txt mydir
Move a file
mv myfile.txt mydir
Remove an empty directory:
rmdir mydir
Remove a directory:
rm -rf mydir
Remove a file:
rm myfile.txt
Rename a file or directory:
mv myfile.txt newfile.txt
show a file content:
cat myfile.txt
show a file with the less command:
less myfile.txt
Archive some files:
tar -cvf doc.tar *.doc
Compress a tar:
gzip doc.tar
Archive and compress files:
tar -zcvf doc.tar.bz2 *.doc tar -jcvf doc.tar.gz *.doc
Extract archived files:
tar -xvf doc.tar
Decompress a file:
gzip -d doc.tar.gz
Decompress a tar file:
tar -xvf doc.tar
Create a symbolic link:
ln -s myfile.txt mysymboliclink
Create an hard link:
ln myfile.txt myhardlink
Delete a user:
userdel john
Delete a user and his home directory:
userdel -r john
Show information about a user:
chage -l john
Change one of the information about a user (like the minimum number of days between password change):
chage -m 3 john
Add a group:
groupadd hackers
Display user id and group for a user:
id john
Delete a group
groupdel hackers
Add a user to a group:
usermod -aG hackers john
Switch to a different user:
su john
Change the permission to a file:
chmod 755 myfile.txt
Change the owner of a file:
chown -R hackers:hackers myfile.txt
check what user you are logged with:
who i am
Copyright © 2013 Welcome to the website of Davis Fiore. All Rights Reserved.