Difference between revisions of "Shell Commands"
Line 52: | Line 52: | ||
<code>gzip -d filename</code> | <code>gzip -d filename</code> | ||
=== TAR and | === TAR and compress simultaneously === | ||
<code>tar -cvzf newFileName.tar.gz fileOrDirectorToArchiveAndCompress</code> | <code>tar -cvzf newFileName.tar.gz fileOrDirectorToArchiveAndCompress</code> | ||
=== un-TAR and | === un-TAR and decompress simultaneously === | ||
<code>tar xvfz fileName.targz</code> | <code>tar xvfz fileName.targz</code> | ||
Revision as of 07:13, 12 November 2015
Check Linux Version
Determine kernel version:
uname -r
Determine distribution version:
cat /etc/issue
Script command sessions
To log your terminal sessions used script
command:
$script /tmp/terminal.log
CTRL+D to end script logging.
Courtesy of Unix Tutorial site
Regular Expressions
vi
Tape Archival (tar) & gzip
Create tar
tar -cvf filename.tar filemane
Undo tar
tar -xvf filename.tar
List contents tar
tar -tvf filename.tar
Compress file
gzip -9 filename
Decompress file
gzip -d filename
TAR and compress simultaneously
tar -cvzf newFileName.tar.gz fileOrDirectorToArchiveAndCompress
un-TAR and decompress simultaneously
tar xvfz fileName.targz
Download files
To download type wget
then location of file.
Check file integrity
Check MD5 checksum by using md5sum filename
then compare checksum.
Check SHA1 checksum by using sha1sum filename
then compare checksum.
ifconfig
To determine your IP address settings run:
ifconfig
Searching
To find path to a file run:
# find / -name "filename"
To find an expression within a file:
List open files
For example:
lsof -i tcp:80
Comparing files
How do I compare two files under linux or unix
Customize BASH prompt
Customize your bash prompt basics
Networking
tcpdump man page with examples
Firewall
iptables firewall configuration tutorial
Linux Home Networking Linux Firewalls Using iptables
Tips
Find version of OS
cat /etc/redhat-release
cat /etc/redhat-release
cat /etc/fedora-release
cat /etc/SuSE-release
Password protect with Apache
Password protect your pages with htaccess
Find hostname
Use hostname command without arguments
Users and Groups
Hardware
Graphics card
Determine your graphic card run lspci command and find line that contains VGA compatible:
[paul@templar ~]$ lspci 00:00.0 Host bridge: nVidia Corporation C55 Host Bridge (rev a2) 00:00.1 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:00.2 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:00.3 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:00.4 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:00.5 RAM memory: nVidia Corporation C55 Memory Controller (rev a2) 00:00.6 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:00.7 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:01.0 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:01.1 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:01.2 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:01.3 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:01.4 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:01.5 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:01.6 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:02.0 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:02.1 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:02.2 RAM memory: nVidia Corporation C55 Memory Controller (rev a1) 00:03.0 PCI bridge: nVidia Corporation C55 PCI Express bridge (rev a1) 00:06.0 PCI bridge: nVidia Corporation C55 PCI Express bridge (rev a1) 00:07.0 PCI bridge: nVidia Corporation C55 PCI Express bridge (rev a1) 00:09.0 RAM memory: nVidia Corporation MCP51 Host Bridge (rev a2) 00:0a.0 ISA bridge: nVidia Corporation MCP51 LPC Bridge (rev a3) 00:0a.1 SMBus: nVidia Corporation MCP51 SMBus (rev a3) 00:0a.2 RAM memory: nVidia Corporation MCP51 Memory Controller 0 (rev a3) 00:0b.0 USB Controller: nVidia Corporation MCP51 USB Controller (rev a3) 00:0b.1 USB Controller: nVidia Corporation MCP51 USB Controller (rev a3) 00:0d.0 IDE interface: nVidia Corporation MCP51 IDE (rev a1) 00:0e.0 IDE interface: nVidia Corporation MCP51 Serial ATA Controller (rev a1) 00:0f.0 IDE interface: nVidia Corporation MCP51 Serial ATA Controller (rev a1) 00:10.0 PCI bridge: nVidia Corporation MCP51 PCI Bridge (rev a2) 00:10.1 Audio device: nVidia Corporation MCP51 High Definition Audio (rev a2) 00:14.0 Bridge: nVidia Corporation MCP51 Ethernet Controller (rev a3) 01:00.0 VGA compatible controller: nVidia Corporation G92 [GeForce 8800 GT] (rev a2) [paul@templar ~]$
Useful sites
Command Line Fu as in Kung "Fu"