Difference between revisions of "Centos Bash Commands"

From rbachwiki
Jump to navigation Jump to search
Line 14: Line 14:


A slower yet more versatile method for locating files on the filesystem is to use the find com- mand. 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.
A slower yet more versatile method for locating files on the filesystem is to use the find com- mand. 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

Revision as of 21:30, 29 January 2019

Check Bash Shells installed

cat /etc/shells

Check who is logged on

id
whoami
w
who

Check type of System

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

A slower yet more versatile method for locating files on the filesystem is to use the find com- mand. 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.
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