List of commands for Android Terminal Emulator GNU LINUX DEBIAN
- Essential commands to use it
- System information
- Shutdown (System Reboot or Logout)
- Files and Directories
- Find files
- Mounting a file system
- Disk Space
- Users and Groups
- File Permissions (Use ?+? to set permissions and ?-? to remove)
- Special attributes on files (use ?+? to set permissions and ?-? to remove)
- Compressed files and archives
- RPM packages (Red Hat, Fedora and similar)
- YUM package updater (Red Hat, Fedora and similar)
- Deb packages (Debian, Ubuntu and derivatives)
- APT package updater (Debian, Ubuntu and derivatives)
- View the contents of a file
- Text manipulation
- Set character and file conversion
- File system analysis
- Formatting a file system
- Working with SWAP
- Salvas (Backup)
- CD-ROM
- Networking (LAN and Wi-Fi)
- Microsoft Windows Networks (SAMBA)
- IP Boards (FIREWALLS)
- Monitoring and debugging
- Other useful commands
kali linux
How to use the Linux terminal on Android
Essential commands to use it
Let's see some commands that we can use.
your ? Obtain root rights
cd ? Change directories
Uname -a ? Get information about the architecture.
exit ? Exit shell.
ls ? Lists the contents of the directory.
chmod ? Change permissions.
tar ? Creates compressed files.
Many of the famous Linux commands that you use daily in terminal work very well on Android as well, due to the Linux Kernel.
The first thing we will see will be the command that we have configured to be executed as soon as we open the command console or the command that comes by default with the application. In the next line we have the Linu's promptx, the dollar sign ?$?.
First of all, what we need to do is to access the root or Linux superuser by the Console, with the Linux command ?su?. But first we have to access the keyboard, for this we press the Menu key of our Android and you press on "Toggle soft Keyboard". Our keyboard appears and we can type the command and carriage return.
$ su
The Linux command console prompt will change to the ?#?. You are now root. From now on great careThe loaded bullets are already real. We create in our memory card the ?efs? folder, with the command ?mkdir?:
#mkdir /sdcard/efs
And with the following command we copy the folder ?efs? of our Android, with all the subfolders, to the folder ?efs? of the memory card. To do this we use the cp? command with the ?-r? option.
#cp -r /efs/* /sdcard/efs
Ready, we can now enter the /sdcard/efs folder:
#cd /sdcard/efs
and see the content we have copied:
ls -l
This is a small example of all that can be done with the Linux Command Console on Android. Let us know your tips or tricks that you use.
System information
- arch: display the machine architecture (1).
- uname -m: display the machine architecture (2).
- uname -r: show the version of the kernel used.
- dmidecode -q: display the (hardware) components of the system.
- hdparm -i /dev/hda: display the characteristics of a hard disk.
- hdparm -tT /dev/sda: perform a read test on a hard disk.
- cat /proc/cpuinfoDisplay CPU information.
- cat /proc/interrupts: show the interruptions.
- cat /proc/meminfoCheck the memory usage.
- cat /proc/swapsshow swap files.
- cat /proc/version: show the kernel version.
- cat /proc/net/dev: display network adapters and statistics.
- cat /proc/mounts: show the mounted file system.
- lspci -tvPCI devices: display the PCI devices.
- lsusb -tvUSB devices: display the USB devices.
- date: display the system date.
- lime 2011display the 2011 almanac.
- cal 07 2011Show the almanac for the month of July 2011.
- date 041217002011.00: set (declare, adjust) date and time.
- clock -wSave date changes in the BIOS.
Shutdown (System Reboot or Logout)
- shutdown -h now: shut down the system (1).
- init 0: shut down the system (2).
- telinit 0: turn off the system (3).
- halt: turn off the system (4).
- shutdown -h hours:minutes &planned system shutdown.
- shutdown -cCancel a planned system shutdown.
- shutdown -r now: restart (1).
- reboot: restart (2).
- logout: log out.
Files and Directories
- cd /home: enter the ?home? directory.
- cd ...: go back one level.
- cd ../...: go back 2 levels.
- cd: go to the root directory.
- cd ~user1go to the user1 directory.
- cd ?: go (return) to the previous directory.
- pwd: show the path to the working directory.
- ls: view the files in a directory.
- ls -F: view the files in a directory.
- ls -l: show the details of files and folders in a directory.
- ls -a: show hidden files.
- ls *[0-9]*: show files and folders containing numbers.
- tree: display the files and folders in the form of a tree starting from the root.(1)
- lstree: display the files and folders in tree form starting from the root(2).
- mkdir dir1Create a folder or directory named ?dir1?.
- mkdir dir1 dir2Create two folders or directories simultaneously (Create two directories at the same time).
- mkdir -p /tmp/dir1/dir2: create a directory tree.
- rm -f file1: delete the file named ?file1?
- rmdir dir1: delete the folder named "dir1".
- rm -rf dir1: delete a folder named ?dir1? with its content recursively (if I delete it recursively I am saying that it is with its content).
- rm -rf dir1 dir2delete two folders (directories) with their contents recursively.
- mv dir1 new_dirrename or move a file or folder (directory).
- cp file1: copy a file.
- cp file1 file2Copy two files at the same time.
- cp dir /* .copy all files of a directory into the current working directory.
- cp -a /tmp/dir1 .Copy a directory into the current working directory.
- cp -a dir1: copy a directory.
- cp -a dir1 dir2Copy two directories in unison.
- ln -s file1 lnk1: create a symbolic link to the file or directory.
- ln file1 lnk1: create a physical link to the file or directory.
- touch -t 0712250000 file1: modify the real time (creation time) of a file or directory.
- file file1mime type output (screen dump) of a text file.
- iconv -llists of known ciphers.
- iconv -f fromEncoding -t toEncoding inputFile > outputFilecreates a new form of the input file assuming it is encoded in fromEncoding and converting it to ToEncoding.
- find . -maxdepth 1 -name *.jpg -print -exec convert ?{}? -resize 80×60 ?thumbs/{}? \;: group resized files in the current directory and send them to directories in thumbnail views (requires conversion from ImagemagicK).
Find files
- find / -name file1search file and directory from the root of the system.
- find / -user user1search for files and directories belonging to the user ?user1?
- find /home/user1 -name \*.binsearch for files with extension ?.bin? inside the directory ?/home/user1?
- find /usr/bin -type f -atime +100search for binary files that have not been used in the last 100 days.
- find /usr/bin -type f -mtime -10search for files created or changed within the last 10 days.
- find / -name \*.rpm -exec chmod 755 ?{}? \;: search for files with extension ?.rpm? and modify permissions.
- find / -xdev -name \*.rpm: Search for files with extension ?.rpm? ignoring removable devices such as cdrom, pen-drive, etc.?
- locate \*.psfinds files with extension ?.ps? executed first with the ?updatedb? command.
- whereis haltshow the location of a binary, help or source file. In this case it asks where the ?halt? command is located.
- which halt: show the complete path (the complete path) to a binary / executable.
Mounting a file system
- mount /dev/hda2 /mnt/hda2Mount a disk named hda2. First verify the existence of the directory ?/ mnt/hda2?; if it is not there, you must create it.
- umount /dev/hda2: unmount a disk named hda2. Exit first from the point ?/ mnt/hda2.
- fuser -km /mnt/hda2: force disassembly when the device is busy.
- umount -n /mnt/hda2: run the disassembly without reading the /etc/mtab file. Useful when the file is read-only or the hard disk is full.
- mount /dev/fd0 /mnt/floppy: mount a floppy disk.
- mount /dev/cdrom /mnt/cdrom: mount a cdrom / dvdrom.
- mount /dev/hdc /mnt/cdrecorder: mount a rewritable cd or a dvdrom.
- mount /dev/hdb /mnt/cdrecorder: mount a rewritable cd / dvdrom (a dvd).
- mount -o loop file.iso /mnt/cdrom: mount a file or an iso image.
- mount -t vfat /dev/hda5 /mnt/hda5Mount a FAT32 file system.
- mount /dev/sda1 /mnt/usbdisk: mount a usb pen-drive or a memory stick (without specifying the type of file system).
Disk Space
- df -hShow a list of mounted partitions.
- ls -lSr |more: show the size of files and directories sorted by size.
- du -sh dir1Estimate the space used by the ?dir1? directory.
- du -sk * | sort -rn: show the size of files and directories sorted by size.
- rpm -q -a ?qf ?%10{SIZE}t%{NAME}n? | sort -k1,1nshow the space used by installed rpm packages organized by size (Fedora, Redhat and others).
- dpkg-query -W -f=?${Installed-Size;10}t${Package}n? | sort -k1,1n: show the space used by the installed packages, organized by size (Ubuntu, Debian and others).
Users and Groups
- groupadd group_name: create a new group.
- groupdel group_name: delete a group.
- groupmod -n new_group_name old_group_name: rename a group.
- useradd -c ?Name Surname ? -g admin -d /home/user1 -s /bin/bash user1Create a new user belonging to the ?admin? group.
- useradd user1: create a new user.
- userdel -r user1: delete a user (?-r? deletes the Home directory).
- usermod -c ?User FTP? -g system -d /ftp/user1 -s /bin/nologin user1change the user's attributes.
- passwdChange password.
- passwd user1: change the password of a user (only by root).
- chage -E 2011-12-31 user1: set a time limit for the user's password. In this case it says that the password expires on December 31, 2011.
- pwckCheck the correct syntax, the file format of ?/etc/passwd? and the existence of users.
- grpckCheck the correct syntax and format of the ?/etc/group? file and the existence of groups.
- newgrp group_nameRegister a new group to change the default group for newly created files.
File Permissions (Use ?+? to set permissions and ?-? to remove)
- ls -lh: Show permissions.
- ls /tmp | pr -T5 -W$COLUMNS: divide the terminal into 5 columns.
- chmod ugo+rwx directory1set read ®, write (w) and execute(x) permissions to the owner (u), group (g) and others (o) on the directory ?directory1?
- chmod go-rwx directory1Remove read ®, write (w) and execute (x) permissions to group (g) and others (o) on the directory ?directory1?
- chown user1 file1: change the owner of a file.
- chown -R user1 directory1Change the owner of a directory and all the files and directories contained in it.
- chgrp group1 file1: change file group.
- chown user1:group1 file1: change user and group owner of a file.
- find / -perm -u+sSUID: display all files in the system with SUID configured.
- chmod u+s /bin/file1SUID bit in a binary file. The user running that file acquires the same privileges as the owner.
- chmod u-s /bin/file1Disable the SUID bit in a binary file.
- chmod g+s /home/publicSGID bit: place an SGID bit in a directory ?similar to SUID but per directory.
- chmod g-s /home/publicDisable an SGID bit in a directory.
- chmod o+t /home/publicSTIKY bit: place a STIKY bit in a directory. Allows the deletion of files only to the legitimate owners.
- chmod o-t /home/publicDisable a STIKY bit in a directory.
Special attributes on files (use ?+? to set permissions and ?-? to remove)
- chattr +a file1: allows you to write by opening a file in append mode only.
- chattr +c file1allows a file to be compressed / decompressed automatically.
- chattr +d file1: ensures that the program ignores deleting files during the backup.
- chattr +i file1makes the file unchangeable, so it cannot be deleted, altered, renamed, or linked.
- chattr +s file1allows a file to be securely deleted.
- chattr +S file1ensures that a file is modified, changes are written in synchronous mode as with sync.
- chattr +u file1allows you to recover the contents of a file even if it is deleted.
- lsattrshow special attributes.
Compressed files and archives
- bunzip2 file1.bz2: unzip a file named ?file1.bz2?
- bzip2 file1compresses a file named ?file1?
- gunzip file1.gzunzip a file named ?file1.gz?
- gzip file1compresses a file named ?file1?
- gzip -9 file1compresses with maximum compression.
- rar to file1.rar test_file: create a rar file named ?file1.rar?
- rar a file1.rar file1 file1 file2 dir1compress ?file1?, ?file2? and ?dir1? at the same time.
- rar x file1.rar: unzip rar file.
- unrar x file1.rar: unzip rar file.
- tar -cvf archive.tar file1: create an unzipped tarball.
- tar -cvf archive.tar file1 file2 file2 dir1create a file containing ?file1?, ?file2? and ?dir1?.
- tar -tf archive.tar: display the contents of a file.
- tar -xvf archive.tar: extract a tarball.
- tar -xvf archive.tar -C /tmp: extract a tarball in / tmp.
- tar -cvfj archive.tar.bz2 dir1: create a compressed tarball inside bzip2.
- tar -xvfj archive.tar.bz2: unzip a bzip2 compressed tar file
- tar -cvfz archive.tar.gz dir1: create a gzip compressed tarball.
- tar -xvfz archive.tar.gz: unzip a gzip compressed tar file.
- zip file1.zip file1Create a compressed zip file.
- zip -r file1.zip file1 file1 file2 dir1: compress, in zip, several files and directories at the same time.
- unzip file1.zip: unzip a zip file.
RPM packages (Red Hat, Fedora and similar)
- rpm -ivh package.rpm: install an rpm package.
- rpm -ivh ?nodeeps package.rpm: install an rpm package ignoring dependency requests.
- rpm -U package.rpmupdate an rpm package without changing the configuration of the files.
- rpm -F package.rpmupdate an rpm package only if it is installed.
- rpm -e package_name.rpm: remove an rpm package.
- rpm -qashow all rpm packages installed on the system.
- rpm -qa | grep httpdshow all rpm packages with the name "httpd".
- rpm -qi package_name: obtain information on a specific installed package.
- rpm -qg ?System Environment/Daemons?show the rpm packages of a software group.
- rpm -ql package_nameshow list of files given by an installed rpm package.
- rpm -qc package_nameshow list of configuration files given by an installed rpm package.
- rpm -q package_name ?whatrequiresshow list of dependencies requested for an rpm package.
- rpm -q package_name ?whatprovidesshow the capacity given by an rpm package.
- rpm -q package_name ?scriptsShow the scripts started during installation/removal.
- rpm -q package_name ?changelogshow the revision history of an rpm package.
- rpm -qf /etc/httpd/conf/httpd.conf: check which rpm package belongs to a given file.
- rpm -qp package.rpm -lshow list of files given by an rpm package that has not yet been installed.
- rpm ?import /media/cdrom/RPM-GPG-KEYImport the digital signature of the public key.
- rpm ?checksig package.rpmrpm package integrity check: check the integrity of an rpm package.
- rpm -qa gpg-pubkeyCheck the integrity of all installed rpm packages.
- rpm -V package_nameCheck file size, licenses, types, owner, group, MD5 summary check and last modification.
- rpm -VaCheck all rpm packages installed on the system. Use with care.
- rpm -Vp package.rpm: check for an rpm package not yet installed.
- rpm2cpio package.rpm | cpio ?extract ?make-directories *bin*: extract executable file from rpm package.
- rpm -ivh /usr/src/redhat/RPMS/`arch`/package.rpm: install a package built from an rpm source.
- rpmbuild ?rebuild package_name.src.rpmbuild an rpm package from an rpm source.
YUM package updater (Red Hat, Fedora and similar)
- yum install package_nameDownload and install an rpm package.
- yum localinstall package_name.rpmwill install an RPM and try to resolve all dependencies for you, using your repositories.
- yum update package_name.rpmUpdate all rpm packages installed on the system.
- yum update package_name: modernize / update an rpm package.
- yum remove package_name: remove an rpm package.
- yum listList all the packages installed on the system.
- yum search package_name: Find a package in rpm repository.
- yum clean packages: clear an rpm cache by deleting the downloaded packages.
- yum clean headers: delete all header files that the system uses to resolve the dependency.
- yum clean all: delete from the packet cache and header files.
Deb packages (Debian, Ubuntu and derivatives)
- dpkg -i package.deb: install / update a deb package.
- dpkg -r package_name: remove a deb package from the system.
- dpkg -l: display all deb packages installed on the system.
- dpkg -l | grep httpdshow all deb packages with the name ?httpd?
- dpkg -s package_name: obtain information on a specific package installed on the system.
- dpkg -L package_name: show list of files given by a package installed on the system.
- dpkg ?contents package.debshow list of files given by a package not yet installed.
- dpkg -S /bin/ping: check which packet belongs to a given file.
APT package updater (Debian, Ubuntu and derivatives)
- apt-get install package_name: install / update a deb package.
- apt-cdrom install package_name: install / update a deb package from a cdrom.
- apt-get update: update the list of packages.
- apt-get upgrade: update all installed packages.
- apt-get remove package_name: remove a deb package from the system.
- apt-get check: verify the correct resolution of the dependencies.
- apt-get clean: clear cache from downloaded packages.
- apt-cache search searched-packagereturns a list of packages corresponding to the "searched packages" series.
View the contents of a file
- cat file1: view the contents of a file starting from the first row.
- tac file1: view the contents of a file starting from the last line.
- more file1: view the content along a file.
- less file1similar to the command ?more? but allows to save the movement in the file as well as the movement backwards.
- head -2 file1: view the first two lines of a file.
- tail -2 file1: view the last two lines of a file.
- tail -f /var/log/messages: see in real time what has been added to the file.
Text manipulation
- cat file1 file2 ... | command file1_in.txt_or_file1_out.txtGeneral syntax for text manipulation using PIPE, STDIN and STDOUT.
- cat file1 | command( sed, grep, awk, grep, etc?) > result.txtgeneral syntax for manipulating text in a file and writing the result to a new file.
- cat file1 | command( sed, grep, awk, grep, etc?) " result.txtgeneral syntax for manipulating text in a file and appending results to an existing file.
- grep Aug /var/log/messagessearch for words "Aug" in the file "/var/log/messages".
- grep ^Aug /var/log/messages: search for words beginning with ?Aug? in file ?/var/log/messages?
- grep [0-9] /var/log/messagesSelect all lines in the file ?/var/log/messages? that contain numbers.
- grep Aug -R /var/log/*: look for the string ?Aug? in the directory ?/var/log? and below it.
- sed ?s/stringa1/stringa2/g? example.txt: relocate ?string1? to ?string2? in example.txt
- sed ?/^$/d? example.txt: delete all blank lines from example.txt
- sed ?/ *#/d; /^$/d? example.txt: remove comments and blank lines from example.txt
- echo ?esempio? | tr ?[:lower:]? ?[:upper:]?: convert lowercase to uppercase.
- sed -e ?1d? result.txt: deletes the first line of the example.txt file
- sed -n ?/stringa1/p?Display only the lines containing the word "string1".
Set character and file conversion
- dos2unix filedos.txt fileunix.txt: convert a text file format from MSDOS to UNIX.
- unix2dos fileunix.txt fileunix.txt filedos.txtconvert a text file format from UNIX to MSDOS.
- recode ...HTML page.html: convert a text file to html.
- recode -l | more: show all available format conversions.
File system analysis
- badblocks -v /dev/hda1Check for bad blocks on the hda1 disk.
- fsck /dev/hda1: repair / check the integrity of the Linux system file on the hda1 disk.
- fsck.ext2 /dev/hda1: repair / check integrity of ext 2 system file on disk hda1.
- e2fsck /dev/hda1: repair / check integrity of ext 2 system file on disk hda1.
- e2fsck -j /dev/hda1: repair / check integrity of ext 3 system file on disk hda1.
- fsck.ext3 /dev/hda1: repair / check integrity of ext 3 system file on disk hda1.
- fsck.vfat /dev/hda1: repair / check the integrity of the system fat file on the hda1 disk.
- fsck.msdos /dev/hda1: repair / check the integrity of a system file two on disk hda1.
- dosfsck /dev/hda1: repair / check the integrity of a system file two on disk hda1.
Formatting a file system
- mkfs /dev/hda1Create a Linux-like system file in the hda1 partition.
- mke2fs /dev/hda1create a Linux ext 2 type system file in hda1.
- mke2fs -j /dev/hda1create a Linux ext3 (periodic) system file on the hda1 partition.
- mkfs -t vfat 32 -F /dev/hda1: create a FAT32 system file on hda1.
- fdformat -n /dev/fd0Formatting a flooply disk.
- mkswap /dev/hda3: create a swap system file.
Working with SWAP
- mkswap /dev/hda3create swap system file.
- swapon /dev/hda3Activating a new swap partition.
- swapon /dev/hda2 /dev/hdb3: activate two swap partitions.
Salvas (Backup)
- dump -0aj -f /tmp/home0.bak /home: make a complete save of the directory ?/home?
- dump -1aj -f /tmp/home0.bak /home: make an incremental save of the ?/home? directory.
- restore -if /tmp/home0.bak: restoring a save interactively.
- rsync -rogpav ?delete /home /tmpSynchronization between directories.
- rsync -rogpav -e ssh ?delete /home ip_address:/tmp: rsync through the tunnel SSH.
- rsync -az -e ssh ?delete ip_addr:/home/public /home/localSynchronize a local directory with a remote directory via ssh and compression.
- rsync -az -e ssh ?delete /home/local ip_addr:/home/publicSynchronize a remote directory with a local directory via ssh and compression.
- dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr ?dd of=hda.gz?: make a save of a hard disk on a remote host via ssh.
- dd if=/dev/sda of=/tmp/file1save the content of a hard disk to a file (in this case the hard disk is ?sda? and the file ?file1?).
- tar -Puf backup.tar /home/user: make an incremental save of the ?/home/user? directory.
- ( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr ?cd /home/share/ && tar x -p?: copy the contents of a directory to a remote directory via ssh.
- ( tar c /home ) | ssh -C user@ip_addr ?cd /home/backup-home && tar x -p?: copy a local directory to a remote directory via ssh.
- tar cf ? . | (cd /tmp/backup ; tar xf ? )local copy preserving the licenses and links from one directory to another.
- find /home/user1 -name ?*.txt? | xargs cp -av ?target-directory=/home/backup/ ?parentsFind and copy all files with extension ?.txt? from one directory to another.
- find /var/log -name ?*.log? | tar cv ?files-from=- | bzip2 > log.tar.bz2Find all files with extension ?.log? and make a bzip archive.
- dd if=/dev/hda of=/dev/fd0 bs=512 count=1Make a copy of the MRB (Master Boot Record) to a floppy disk.
- dd if=/dev/fd0 of=/dev/hda bs=512 count=1Restore the MBR (Master Boot Record) copy saved on a floppy disk.
CD-ROM
- cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force: cleaning or erasing a rewritable CD.
- mkisofs /dev/cdrom > cd.isoCreate a cdrom iso image on disk.
- mkisofs /dev/cdrom | gzip > cd_iso.gzCreate an iso compressed cdrom iso image on disk.
- mkisofs -J -allow-leading-dots -R -V ?Label CD? -iso-level 4 -o ./cd.iso data_cd: create an iso image from a directory.
- cdrecord -v dev=/dev/cdrom cd.isoburn an iso image.
- gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom ?Burn a compressed iso image.
- mount -o loop cd.iso /mnt/isoMount an iso image.
- cd-paranoia -B: convert songs from cd to wav files.
- cd-paranoia ? ?-3?: convert the first 3 songs of a cd to wav files.
- cdrecord ?scanbus: scan bus to identify the scsi channel.
- dd if=/dev/hdc | md5sum: run an md5sum on a device, such as a CD.
I work with the NETWORK ( LAN and Wi-Fi)
- ifconfig eth0Ethernet network card: display the configuration of an Ethernet network card.
- ifup eth0: activate an interface ?eth0?
- ifdown eth0Disable an ?eth0? interface.
- ifconfig eth0 192.168.1.1.1 netmask 255.255.255.0: configure an IP address.
- ifconfig eth0 promiscconfigure ?eth0?in common mode to obtain the packets (sniffing).
- dhclient eth0: enable interface ?eth0? in dhcp mode.
- route -n: show tour table.
- route add -net 0/0 gw IP_Gateway: set default input.
- route add -net 192.168.0.0.0 netmask 255.255.0.0 gw 192.168.1.1: configure static route to search for network ?192.168.0.0/16?
- route from 0/0 gw IP_gateway: delete the static route.
- echo ?1? > /proc/sys/net/ipv4/ip_forward: activate the ip route.
- hostname: display the host name of the system.
- host www.example.com: look up the host name to resolve the name to an ip(1) address.
- nslookup www.example.com: look up the host name to resolve the name to an ip address and vice versa(2).
- ip link showshow the link status of all interfaces.
- mii-tool eth0show the link status of eth0.
- ethtool eth0show ?eth0? network card statistics.
- netstat -tup: display all active network connections and their PIDs.
- netstat -tuplShow all network listener services in the system and their PIDs.
- tcpdump tcp port 80: show all traffic HTTP.
- iwlist scan: display the wireless networks.
- iwconfig eth1: display the configuration of a wireless network card.
- whois www.example.comWhois database search.
Microsoft Windows Networks (SAMBA)
- nbtscan ip_addrNetwork name resolution bios.
- nmblookup -A ip_addrNetwork name resolution bios.
- smbclient -L ip_addr/hostnameShow remote actions of a host in windows.
IP Boards (FIREWALLS)
- iptables -t filter -L: show all the strings in the filter table.
- iptables -t nat -L: show all the strings of the nat table.
- iptables -t filter -FClear all the rules of the filter table.
- iptables -t nat -F: clear all the rules of the nat table.
- iptables -t filter -XDelete any string created by the user.
- iptables -t filter -A INPUT -p tcp ?dport telnet -j ACCEPT: allow telnet connections to log in.
- iptables -t filter -A OUTPUT -p tcp ?dport http -j DROP: blocking connections HTTP to exit.
- iptables -t filter -A FORWARD -p tcp ?dport pop3 -j ACCEPT: enable connections POP to a front chain.
- iptables -t filter -A INPUT -j LOG ?log-prefix ?DROP INPUT?: registering an input string.
- iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEConfigure a PAT (Port Address Translation Port) on eth0, hiding the forced outgoing packets.
- iptables -t nat -A PREROUTING -d 192.168.0.1 -p tcp -m tcp ?dport 22 -j DNAT ?to-destination 10.0.0.2:22Redirect packets routed from one host to another.
Monitoring and debugging
- top: show linux tasks using the most cpu.
- ps -eafwLinux tasks: displays Linux tasks.
- ps -e -o pid,args ?forestdisplays the Linux tasks in a hierarchical mode.
- pstree: display a process system tree.
- kill -9 Process_ID: to force the closing of a process and terminate it.
- kill -1 Process_ID: force a process to reload the configuration.
- lsof -p $$: display a list of open files by process.
- lsof /home/user1shows a list of open files in a given system path.
- strace -c ls >/dev/null: display the system calls made and received by a process.
- strace -f -e open ls >/dev/null: display the calls to the library.
- watch -n1 ?cat /proc/interrupts?: display interruptions in real time.
- last rebootShow restart history.
- lsmod: show the loaded kernel.
- free -mRAM: shows the RAM status in megabytes.
- smartctl -A /dev/hdaSMART: monitor the reliability of a hard disk through SMART.
- smartctl -i /dev/hdaCheck if SMART is activated on a hard disk.
- tail /var/log/dmesgshow events inherent to the kernel loading process.
- tail /var/log/messages: display the system events.
Other useful commands
- apropos ?keywordshow a list of commands that belong to the keywords of a program; they are useful when you know what your program does, but you don't know the name of the command.
- man pingshow the manual pages on-line; for example, in a ping command, use the ?-k? option to find any related commands.
- whatis ?keywordshows the description of what the program does.
- mkbootdisk ?device /dev/fd0 `uname -r`: create a bootable floppy.
- gpg -c file1Encrypt a file with GNU security guard.
- gpg file1.gpgdecode a file with GNU Security Guard.
- wget -r www.example.com: download a complete website.
- wget -c www.example.com/file.iso: download a file with the possibility to stop the download and resume it later.
- echo ?wget -c www.example.com/files.iso? at 09:00: Start a download at any time. In this case it would start at 9 o'clock.
- ldd /usr/bin/sshshow the shared libraries required by the ssh program.
- alias hh=?history?: place an alias for a command ?hh= History.
- chshChange the Shell command.
- chsh ?list-shellsis a command suitable to know if you have to make remote in another terminal.
- who -ashow who is logged in, and print time of last system import, dead processes, system log processes, active processes produced by init, current running and last system clock changes.
Leave a Reply
You must be logged in to post a comment.