Changes

Jump to navigation Jump to search
4,086 bytes removed ,  18:22, 25 April 2013
Line 249: Line 249:     
{{tip box|msg=It is possible to use putty if you are afraid about some commands in a terminal, you can find a lot of examples by typing this in google [https://www.google.com/search?q=tunneling+by+putty tunneling by putty]}}
 
{{tip box|msg=It is possible to use putty if you are afraid about some commands in a terminal, you can find a lot of examples by typing this in google [https://www.google.com/search?q=tunneling+by+putty tunneling by putty]}}
  −
==Command-Line Quick Reference Guide==
  −
Below is a list of commands that I use all the time & tend to forget.
  −
===Generic Linux===
  −
  −
{| class="wikitable"
  −
|-
  −
! COMMAND NAME !! DESCRIPTION
  −
|-
  −
| df -h || shows disk usage in human readable form
  −
|-
  −
| man <commandname> || shows more info about a command
  −
|-
  −
| uname -a || kernel release version
  −
|-
  −
| /usr/sbin/smbd -V || samba version
  −
|-
  −
| /usr/sbin/httpd -v || apache version
  −
|-
  −
| mysql -v || mysql version
  −
|-
  −
| php -v ||  php version
  −
|-
  −
| mv || moves or renames a file
  −
|-
  −
| cp || copies or backup a file
  −
|-
  −
| rm || removes or deletes a file
  −
|-
  −
| ps -aux|grep <process> || outputs processes running <process>
  −
|-
  −
| ps -AH || report process status
  −
|-
  −
| top || shows processes
  −
|-
  −
| top -i ||  shows only active processes
  −
|-
  −
|  htop  || shows processes (more versatile than top)
  −
|-
  −
| iptraf || shows network info
  −
|-
  −
| mc -d  || show midnight commander (cli file browser) to navigate through system easily
  −
|-
  −
| cat /proc/mdstat || shows software raid
  −
|-
  −
|  host -t mx aol.com || shows the mx records for aol.com
  −
|-
  −
| net groupmap list || shows samba mappings to nt groups
  −
|-
  −
| telinit 1 || changes to single user mode
  −
|-
  −
| ifconfig || shows detailed info on ethernet ports
  −
|-
  −
| grep -r "casesensitivesearch" * || finds all documents containing the criteria in a dir
  −
|-
  −
| tail -f /var/log/<LOGFILE> || realtime viewing of your log file
  −
|-
  −
| hdparm -Tt /dev/mdx (where x is 0,1,2,etc) || shows software raid performance
  −
|-
  −
| mdadm --detail /dev/mdx (where x is 0,1,2,etc) || gives raid info
  −
|-
  −
| tar -czvf foo.tar.gz foo || creates a tar/zip file of a directory
  −
|-
  −
| tar -xvzf foo.tar.gz || untar/unzip a tar/zip file
  −
|-
  −
| scp -P <ssh_portnumber> foo.tar.gz <user>@<other_server_ipaddress>:/opt || transfers file to another server in /opt directory
  −
|-
  −
| rsync --progress -te "ssh -p <ssh_portnumber>" foo <other_server_ipaddress>:/opt  || transfers file to another server
  −
|-
  −
| sed -i s/foo/fee/g <FILENAMEORPATHTODIR> || replaces foo with fee
  −
|}
  −
  −
  −
Estimate file space usage - drill down into directories
  −
cd /
  −
du --si --max-depth 1
  −
cd /home
  −
du --si --max-depth 1
  −
cd /home/e-smith
  −
du --si --max-depth 1
  −
  −
===RPM's===
  −
  −
{| class="wikitable"
  −
|-
  −
! Command !! Explanation
  −
|-
  −
| rpm -qa || shows all rpms installed
  −
|-
  −
| rpm -qa --last || shows all rpms installed & installation date
  −
|-
  −
| rpm -q  || asks for rpm info
  −
|-
  −
| rpm -qi  || asks for detailed rpm info
  −
|-
  −
| rpm -ql <packagename> || lists all files in a package
  −
|-
  −
| rpm -qf <filename> || reports what package a file belongs to
  −
|}
  −
  −
===YUM'ing and repositories===
  −
{| class="wikitable"
  −
|-
  −
! Command !! Explanation
  −
|-
  −
| yum install <packagename> || installs packagename & any package it may need
  −
|-
  −
| yum remove <packagename> || removes packagename
  −
|-
  −
| yum list updates || list updates to any installed package
  −
|-
  −
| yum list available || list available packages in all repos not already installed
  −
|-
  −
| yum list available |grep <reponame> || list available packages -shows only from repo name
  −
|-
  −
| yum search <packagename>  || lists all packages in all repos matching packagename
  −
|-
  −
| yum clean all || Is used to clean up various things which accumulate in  the  yum cache
  −
|-
  −
| yum --enablerepo=<reponame> <command> || enables a repo not normally enabled
  −
|-
  −
|  /sbin/e-smith/audittools/newrpms || shows all extra packages installed
  −
|-
  −
| /sbin/e-smith/audittools/repositories || show all repositories and if they are activated or not
  −
|-
  −
| db yum_repositories show <reponame> || show properties of the repository <reponame> '''(you may use TAB to auto-complete your command line)'''
  −
|}
  −
  −
====Restoring Default Yum Repositories====
  −
  −
{{note box|If you have problems with your yum setup you may have entered incorrect repository values. Remove the current values and restore the original setting with these commands}}
  −
  −
cd /home/e-smith/db/
  −
mv yum_repositories yum_repositories.po
  −
/etc/e-smith/events/actions/initialize-default-databases
  −
  −
Now you have a clean install, you can re-add 3rd party repos as described above
  −
  −
signal-event yum-modify
  −
  −
and check if you can update your server
  −
  −
yum update
      
==SME Server specific==
 
==SME Server specific==

Navigation menu