Draft Newest approved | Approver: psycore
This is an old revision of the document!
Linux commands
My collection of commands for Linux .
Command list
User Management
| Command | Comment |
|---|---|
| /usr/bin/ftptop | Show information about ProFTPd |
| adduser <username> | create user with additional information incl. homedir |
| passwd <username> | change password |
| su <user> | set user |
| sudo shutdown -s | Pass command as root |
| useradd -d <homedir> <username> | create user with home dir |
| userdel <username> | delete user |
| whoami | Output current user |
File and Directory Management
| Command | Comment |
|---|---|
| chgrp <user> <datei/ordner> | Change group |
| chown <user> <datei/ordner> | Change owner |
| cp -r newdir/* olddir/ | copy files recursively |
| 'cp' -rf dir/{*,.??*} /dir/ | hidden files and aliased cp -i will be copied |
| du -hs <dir> | specify directory size |
| du -h * | sort -hr > /home/user/filelist.txt | file list sorted by size |
| echo bla > 1.txt | Create file 1.txt with content bla |
| echo blabla » 1.txt | Append blabla to file 1.txt |
| ls -lahS $(find / -type f -size +100000k) | search for files > 100MB |
| ls -la dir | listing |
| pwd | output working directory |
| tar xfz u-web-my4.tgz | extract file |
| whereis | Output binary directory |
Package management
| Command | Comment |
|---|---|
| apt-cache search <pack> | search for a package |
| apt-get install <pack> | install pack |
| apt-get update | update package cache |
| apt-get upgrade | upgrade installed packages |
System Management
| Command | Comment |
|---|---|
| cat /proc/cpuinfo | cpuinfo |
| cat /proc/meminfo | RAM Info |
| cat /proc/version | Deb Version |
| crontab -e | Edit cronjobs |
| crontab -l | List cronjobs |
| date +%s | Output Unix time |
| date -d @1234631164 | output Unix time in normal time |
| df -h | free disk space |
| dpkg-reconfigure locales -plow | Language settings |
| dpkg-reconfigure tzdata | Time zone settings |
| kill -6 <PID> 1) | SIGABRT - Abort process |
| kill -9 <PID> | SIGKILL - terminate process |
| kill -15 <PID> | SIGTERM - terminate process cleanly |
| kill -18 <PID> | SIGCONT - Continue process |
| kill -19 <PID> | SIGSTOP - stop process |
| mount -o remount -rw / | release write-protected file system |
Network Management
| Command | Comment |
|---|---|
| ifconfig | show IP address and netmask |
| netstat -pantu | Connections/Ports |
| nload -u H | Show bandwidth |
| sh blubb.sh | sh file execute |
| wget http://www.psoft.net/shiv/HS/u-web-my4.tgz | gets file |
Start and stop
| Command | Comment |
|---|---|
| shutdown -s | Shut down or switch off the system |
| shutdown -r | Restart (reboot) |
| shutdown -l | User logout |
| shutdown -s -f | forced shutdown |
Change Linux time
Set the time under Linux. 2)
[me@mybox me]$ su password: Check the current date and time of the Linux box by entering: [root@mybox me]# date Linux yields the current settings: [root@mybox me]# Wed Apr 7 12:03:45 EDT 2004 Change the current time and date of the Linux box by entering: [root@mybox me]# date 040713032004 would change the time and yield: [root@mybox me]$ Wed Apr 7 13:03:00 EDT 2004
Load Apache modules
a2enmod modname
activate, or with
a2dismod modname
deactivate. Subsequently, a restart of the web server with
/etc/init.d/apache2 restart
is necessary.
Run Froxlor Cron
1)
PID denotes the process ID