Linux/Unix System Commands

Submitted by code_admin on Mon, 07/30/2018 - 13:31

Server Info

Logins

  1. last

Uptime

  1. uptime

Reboot

  1. sudo reboot

Version

Os Version
Command Explination
uname -a Find system version
oslevel Find version (AIX)
cat /etc/lsb-release Version
AIX Preformance
Command Explination
topas Perdformance analysis program (q=quit)
Extra Info: http://publib.boulder.ibm.com/infocenter/powersys/v3r1m5/index.jsp?topic=/iphcg/topas.htm
topas -P Perdformance analysis program Processes (q=quit)
sar

sudo command to run as root user

/etc/init.d directory has stuff to start and stop.

ls -la
sudo chmod -vR 777 www

Download a file
wget http://ftp.drupal.org/files/projects/drupal-6.11.tar.gz

taring/un

tar -zcf outputfile.tar.gz dir
tar xvzf drupal-6.11.tar.gz

Moving
ls -A . | while read i; do mv ./"$i" /var/www/; done

Deleting
rm -r <>

Create a Symbolic Link
ln -s /path/to/real/file /path/to/non-existant/file

Install programs

sudo apt-get install openssh-server

Get list of installed programs

dpkg --get-selections > installed-software

Network Commands

ip a

Apache Commands

apache
restart: sudo /etc/init.d/apache2 restart
list enablled modules: sudo apache2ctl -l
enable module rewrite: sudo a2enmod rewrite
disable module: a2dismod
enable site robsite: sudo a2ensite robsite

mySQL

mysql -uroot -p<>

Ubuntu Process Listing Commands

top
ps aux

Network

netstat -tulpn
netstat -tap
sudo iptables -L -n (Current Firewall rules)

User Management

Command Meaning
groups lists the groups you are a member of
vi /etc/group Show all groups
groups $$USERNAME$$ lists the groups this user is a member of
addgroup Add a new group
users lists users
userdel -r $$USERNAME$$ delete a user
adduser $$USERNAME$$ Add a new user - creates all stuff
adduser $$USERNAME$$ $$GROUPNAME$$ Add a user to a group

Email

mailx
ps aux | grep mail

Package Manager

Command Meaning System
rpm -qa List all installed packages (Use rpm -qa > t.txt)
or searching rpm -qa | grep ***SEARCH STRING***
Red Hat

Searching

grep -RH --include "*.sql" IC_GMS_LD_ACT_ENC_MV *

Utilities

Check file encoding
enca -Lnone <>
Change file to UTF-8
???Load windows machine and do it on that!!!

http://manpages.ubuntu.com/manpages/hardy/man1/enca.1.html

Output file to screen and file use tee.

  1. ls | tee file.txt

Check filesystem size

  1. df -h

Tags

RJM Article Type
Quick Reference