12dez11
COMMAND LINE COMMANDS






C
ommands
I Forget


Files/Directories:

Create file:
touch
Delete file:
rm
Copy file:
cp
Move file:
mv
Create directory:
mkdir
Delete directory:
rm -r
rm -rf
Delete empty directory:
rmdir

Copy directory:
cp -r dir1 dir2


Create Symbolic/Soft Links:

ln -s destination/file destination/link


Archives:

extract filename.tar:
tar -xvf filename.tar
create filename.tar:
tar -cvf filename.tar filename
extract filename.tar.gz:
tar -xvzf filename.tar.gz
create filename.tar.gz:
tar -czpf /path/filename.tar.gz /path/file(s)-to-archive
extract filename.tar.bz2:
tar jxvf filename.tar.bz2
create filename.tar.bz2:
tar jxvf filename.tar.bz2 dir1 dir2 file1 file2 ...
extract filename.rar:
unrar-free filename.rar
unrar x filename.rar
extract filename.zip:
unzip filename.zip
create filename.zip:
zip filename.zip dir1 dir2 ...



Command line installation:

sudo dpkg -i filename.deb


System info:

Info hardware:
inxi
Info graphics:
inxi -G
Bus-system:
lspci
Bus-system verbose:
lspci -v
Network:
lcpci | grep -i net
Wireless adapter:
iwconfig


Network:

Network adapter:
lcpci | grep -i net
Wireless adapter:
iwconfig

Stop network:
ifdown eth0
Start network:
ifup wlan0


Users / Groups:

Add user:
adduser <username>
Delete user:
deluser <username>
delete files:
deluser -r <username>
Change password:
passwd <username>
List group membership:
groups <username>
detailed:
id <username>
List all groups:
cat /etc/group
(cat /etc/group |cut -d: -f1; cat /etc/passwd | cut -d: -f1)
Add group:
addgroup <groupname>
Delete group:
delgroup <groupname>
Add user to group:
adduser <username> <groupname>
gpasswd -a <user> <group>
e.g.:
gpasswd -a daniel kvm
Delete user from group:
gpasswd -d <user> <group>
Edit groups:
sudo vim /etc/group



Daemons/Services:

Start daemon:
modprobe <daemon_name>
e.g.:
modprobe kvm
Services:
/etc/init.d/service start
/etc/init.d/service stop
e.g.:
samba, mysql, apache


Modules:

Blacklist modules:
sudo vim /etc/modprobe.d/<name>.conf
e.g.:
sudo vim /etc/modprobe.d/wlan.conf
add:
blacklist <module>
e.g.:
blacklist bcma
blacklist acer_wmi


Drives:

List drives:
fdisk -l
mount drive:
mkdir /media/drive
mount /dev/sdh /media/drive
unmount drive:
umount /media/drive