Linux Command List v1.1: Terms of Use
Linux Command List v1.1: Terms of Use
Linux Command List v1.1: Terms of Use
it
Linux Command List v1.1 (last changes 10 Jan 2008 03.05 am)
Terms of use
Except where otherwise specified, the contents of LinuxGuide.it are licensed under
License "Creative Commons" Attribution 2.5
• Attribution — You must attribute the work in the manner specified by the author or licensor (but not
in any way that suggests that they endorse you or your use of the work).
• Noncommercial — You may not use this work for commercial purposes.
• No Derivative Works — You may not alter, transform, or build upon this work.
• For any reuse or distribution, you must make clear to others the licence terms of this work.
• Any of the above conditions can be waived if you get permission from the copyright holder.
• The author's moral rights are retained in this licence.
COMMAND DESCRIPTION
System information
reboot reboot(2)
cd go to home directory
cd - go to previous directory
File search
find /home/user1 -name "*.bin" search files with '. bin' extension
within directory '/ home/user1'
find /usr/bin -type f -atime +100 search binary files are not used in
the last 100 days
find / -name *.rpm -exec chmod 755 '{}' \; search files with '.rpm' extension
and modify permits
Mounting a Filesystem
Disk Space
useradd -c "Name Surname " -g admin -d /home/user1 -s /bin/bash create a new user belongs "admin"
user1 group
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1 change user attributes
Special Attributes on files (use "+" to set permissions and "-" to remove)
chattr +a file1 allows write opening of a file only
append mode
rar a file1.rar file1 file2 dir1 compress 'file1', 'file2' and 'dir1'
simultaneously
tar -cvf archive.tar file1 file2 dir1 create an archive containing 'file1',
'file2' and 'dir1'
zip -r file1.zip file1 file2 dir1 compress in zip several files and
directories simultaneously
unzip file1.zip decompress a zip archive
rpm -qa | grep httpd show all rpm packages with the
name "httpd"
rpm2cpio package.rpm | cpio --extract --make-directories *bin* extract executable file from a rpm
package
Text Manipulation
cat file_test | [operation: sed, grep, awk, grep, etc] > result.txt syntax to elaborate the text of a file,
and write result to a new file
cat file_originale | [operazione: sed, grep, awk, grep, etc] >> syntax to elaborate the text of a file
result.txt and append result in existing file
sed '/ *#/d; /^$/d' example.txt remove comments and blank lines
from example.txt
recode ..HTML < page.txt > page.html convert a text file to html
Filesystem Analysis
SWAP filesystem
Backup
rsync -rogpav -e ssh --delete /home ip_address:/tmp rsync via SSH tunnel
dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz' make a backup of a local hard disk
on remote host via ssh
( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar copy a local directory on remote
x -p' directory via ssh
find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > find all files with '.log' extention and
log.tar.bz2 make an bzip archive
CDROM
route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 configure static route to reach
network '192.168.0.0/16'
IPTABLES (firewall)
iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT allow telnet connections to input
iptables -t filter -A OUTPUT -p tcp --dport http -j DROP block HTTP connections to output
iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT allow POP3 connections to forward
chain
iptables -t filter -A INPUT -j LOG --log-prefix "DROP INPUT" logging sulla chain di input Logging
on chain input
iptables -t nat -A PREROUTING -d 192.168.0.1 -p tcp -m tcp --dport redirect packets addressed to a host
22 -j DNAT --to-destination 10.0.0.2:22 to another host
Except where otherwise specified, the contents of LinuxGuide.it are licensed under License "Creative Commons"
Attribution 2.5:
Free Distribution if provided Authors and, Not Commercial purposes and, Not Derivated Works 2.5 Italy.
LinuxGuide.it assumes no responsibility and in no case can be attributed to physical damage, moral or otherwise caused by content, by
command, from configurations and any other content published on www.linuxguide.it or copies of the same content distributed by third
parties.