- To find out what OS you're running
cat /etc/issue.net
- To find out hardware specs:
RAM and CPU info:
cat /proc/meminfo
cat /proc/cpuinfo
Hard drive info:
df -H
sudo adduser username
sudo passwd username
- Change an existing user to a sudo user
sudo usermod -a -G sudo username
- Delete user:
deluser jondoe
- To add new user and include him in a particular group, e.g. groupname:
useradd username -g groupname
- or to create user user81 and create his home directory in /home:
useradd -d /home/user81 user81
- to create home directory for an existing user:
sudo mkdir /home/user1
sudo chown -R user1 /home/user1
- To find out what groups user belongs to :
groups username
- To add user userid to groupd groupname:
usermod -G groupname userid
- find file with certain name - for
example variables.none.tmpl, in certain directory tree - for example
/var/www, (it will search through all the subdirectories as well) use:
sudo find /var/www -name 'variables.none.tmpl'
- To find all files that contain text ear: (this will look through all files in tmp/container/ directory and all its subdirectories)
fgrep -r 'ear' tmp/container/*
- To list all software packages installed on the current machine:
rpm -qa | less
- To find the full name of the package:
rpm -qa | grep packageName
e.g.:
rpm -qa | grep mysql
- To move all files in current directory to directory named destination:
mv * home/andrey/destination/
- To compress into .tar.gz use the following syntax:
tar -zcvf archive_name.tar.gz directory_to_compress
- To extract file filename.tar.gz:
tar xvzf filename.tar.gz
- In order to copy files from this server to remote server to directory /home/akashliev/ (say, remote server has ip address 192.169.0.10):
scp index.html akashliev@192.168.0.10:/home/akashliev/
- To copy directory build run:
scp -r build/ akashliev@192.168.0.10:/home/akashliev/
- To list all partitions of the hard drive:
sudo fdisk -l
- To swapon partition (e.g. if partition name is /dev/sda3):
sudo swapon /dev/sda3
- To install .deb package in ubuntu
sudo dpkg -i package.deb
- To clear terminal fully (without the possibility to scroll up after it as it is the case with 'clear' command):
reset