|
||||
| Syntax and usage of Linux commands | ||||
| Command | Use / Syntax | Remarks | ||
| useradd | useradd -d /home/name -n username | create user and home directory | ||
| usermod | usermod oldacc -l newacc | change account name old/new | ||
| usermod olddir -l newdir | change directory name old/new | |||
| usermod -G group,group,group..n username | puts user in named groups | |||
| groupmod | groupmod -n newgroupname oldgroupname | changes group name new/old | ||
| newgrp | newgrp promnix | change current group to promnix | ||
| chown | chown peter filename | give peter ownership of file | ||
| chgrp | chgrp promnix filename | give promnix group rights to file | ||
| chmod | chmod ugo=rwx filename | change permissions of file to all rwx | ||
| chage | chage -E 2002/05/13 | account expires 13 May 2002 | ||
| passwd | passwd -l name | locks account by adding ! | ||
| passwd | passwd john | changes john's password | ||
| userdel | userdel -r name | remove user and home dir files | ||
| groupadd | groupadd groupname | add new group | ||
| groupdel | groupdel promnix | remove promnix group if ok | ||
| rpm | rpm --rebuilddb | rebuilds RPM database | ||
| rpm -ivh samba-2.08-12mdk.i386.rpm | installs samba [-Uvh upgrades] | |||
| rpm -qi samba | queries rpm database re samba | |||
| rpm --rebuild samba-2.08-14mdk.i386 | rebuilds a binary package from source | |||
| rpm -e samba-2.08-14mdk.i386 | uninstall package | |||
| dpkg | dpkg --install package | installs package | ||
| dpkg -P samba | purges / removes package (also -r) | |||
| alien | alien --to-rpm program-1.2.3-i386.deb | convert debian package to rpm | ||
| apt-get | apt-get update | debian web based update of packages | ||
| tar | tar -cvf backupfile.tar filenames | creates archive in xxx.tar format | ||
| tar -cvf /dev/st0 filenames | archive to tape | |||
| tar -xvf backupfile.tar | extracts files from archive | |||
| mount | mount -w -t ext2 /dev/sda3 /mnt/scsi | mount in write mode the 3rd scsi partition | ||
| " | mount -t ext2 -o rw /dev/sda3 /mnt/scsi | mount in write mode the 3rd scsi partition | ||
| " | ||||
| smbclient | smbclient //hertz/peter | connect to hertz and have ftp type rights | ||
| smbmount | smbmount //hertz/peter /mnt/xxxx | mount a remote share for copying etc | ||
| chkconfig | chkconfig --list [also ntsysv and tksysv] | list services at each runlevel | ||
| " | chkconfig --level 3 smb on | enable samba at runlevel 3 | ||
| fdisk | "fdisk /dev/had" | check partition information for ide drive 1 | ||
| mkfs | "mkfs -t ext2 /dev/hda" | format ext2 fstype for ide drive | ||
| mt | mt -f /dev/st0 fsf 1 | move tape head by 1 count [of files} | ||
| gdb | gdb - c core | analyse core dump | ||
| du | du -h --max-depth=2 | check disk usage down to 2 dir levels | ||
| df | df -h | check disk space usage, human readable | ||
| ps | ps -u tynan | show process status for user tynan | ||
| nice | nice -n -15 process1 | increase the priority of process1 | ||
| kill | kill -s 15 2304 | closes down process 2304 via shutdown | ||
| killall | killall processnameX | terminates all processnameX | ||
| free | free -m -s 10 | check memory in megabytes every 10 sec | ||
| dd | dd if=/dev/zero of=swap.swp bs=1024 count=10000 | create an empty swap file | ||
| mkswap | mkswap /swap.swp | format the file as a swap partition | ||
| swapon | swapon /swap.swp | turn the swap file on for use | ||
| lpq | lpq -Pdeskjet | checks the print queue of deskjet | ||
| lpr | lpr -Pdeskjet filename | prints filename to remote printer deskjet | ||
| lprm | lprm 4506 | removes job 4506 as listed by lpq | ||
| lpc | lpc -Pdeskjet stop [also start, up, down, enable...] | stops printing to deskjet | ||
| lsmod | lsmod | check which kernel modules are loaded | ||
| hdparm | hdparm -t /dev/hdb | test harddrive transfer rates | ||
| dmesg | dmesg | grep eth0 | shows the kernel boot up info for eth0 | ||
| setserial | setserial -a /dev/Stty1 | show comm2 settings, resource use | ||
| ifconfig | ifconfig eth0 | show ethernet0 address and status | ||
| route | route -n | show routing info with 0.0.0.0 as default | ||
| fsck | fsck /dev/hdb | file system check hard drive 2 | ||
| lsof | lsof | list of open files | ||
| ping | ping 192.168.1.100 | test connection to address on network | ||
| traceroute | traceroute 192.168.1.200 | check path to destination | ||
| find | find -name filename -print | find all files = filename | ||
| locate | locate filename | finds file if in database | ||
| whereis | whereis util | searches /bin directories for util | ||
| grep | grep pattern files | searches files for pattern | ||
| more | more filename [or less filename] | scrolls file contents with page stops | ||
| cat | cat filename > destination | sends file contents to destination | ||