Difference between revisions of "Centos Bash Commands"

From rbachwiki
Jump to navigation Jump to search
(Replaced content with "'''Check Bash Shells installed''' cat /etc/shells ''' Check who is logged on ''' id whoami w who ''' Check type of System''' uname -a")
Tag: Replaced
Line 8: Line 8:
''' Check type of System'''
''' Check type of System'''
  uname -a
  uname -a
==File Commands==
locate filename
The locate command looks in a premade database that contains a list of all the files on the system. This database is indexed much like a textbook for fast searching, yet can become outdated as files are added and removed from the system, which happens on a regular basis. As a result, the database used for the locate command (/var/lib/mlocate/mlocate.db) is updated each day automatically and can be updated manually by running the updatedb command at a command prompt. You can configure the directories that are searched by the updatedb command by editing the /etc/updatedb.conf file.
  find /etc -name inittab
  updatedb # will update the database
A slower yet more versatile method for locating files on the filesystem is to use the find command. The find command does not use a premade index of files; instead, it searches the directory tree recursively, starting from a certain directory for files that meet a certain criterion.
<br />
To use wild card characters with the find command, enclose with "host*"
find /etc -name "host*"
To find all files starting from the /var directory that have a size greater than 4096K (kilobytes), you can use the following command:
find /var -size +4096k
Find all the directories only underneath the /boot directory, you can type the following command:
find /boot -type d
Which Command searches directories that are listed in a special variable called the PATH variable in the BASH shell
which ls
/bin/ls
which grep
/bin/grep

Revision as of 15:17, 6 February 2019

Check Bash Shells installed

cat /etc/shells

Check who is logged on

id
whoami
w
who

Check type of System

uname -a