Linux Commands

From The Dubins
Jump to: navigation, search
    RM Command Safety
    remap the rm command to be 'rm -i'   
    Do this by editing the .profile with:  alias rm='rm -i' 




To check RedHat installation version: cat /etc/redhat-release


To cd or change to a directory with spaces in the path, use "double quotes around the entire target path "


Do copy a folder to a new folder in the same path:

Suppose you are at /home/someplace/ and you want to copy /home/someplace/SourceFolder to a new folder, to the following at /home/someplace/

cp -r SourceFolder NewDestinationFolder


To copy all the files in a directory to a new directory, enter:

    cp -R * /new/file/location


To check memory usage on the server:

TOP

cat /proc/meminfo

free -m



   vi removing trailing blanks workaround
   cut -c1-40 m3a.cvs > m3aclean.cvs
   vi searching
   (shift + colon, then)
   :g/stuff/p
   cat file1 file2 file3 > file4
   This command combines the contents of the first three files into the fourth file.
     
   Network and IP configuration:
   system-config-network
   ps -ef | grep STUFF-U-WANT
   Find out which directories have the most stuff in them
   du -ks * | sort -nr
   Basic VI Commands
    What shell am I using?
    ps -p$$
    -or-
    echo $SHELL
    ps -ef | grep somthing
      OR
    lsof | grep something


Check the space used on the hard disks: df -h for human

use 'set -o vi' if your previous command is not working or backspace is not working. f

Here's a script to use for checking if process are running. It's instead of ps.

   if  -z $1 ;
       then
       print 'usage: chk <include> <exclude>'
   else 
   if  -z $2 ;
      then
   if ps -aef|grep $1|grep -v 'grep'|grep -v 'ps -aef';
      then
      return 0
   else
      return 1
   fi
   else
   ps -aef|grep $1|grep -v $2|grep -v 'grep'|grep -v 'ps -aef';
   fi
   fi


Fedora Mirrors

Yum Update Fedora Core