Skip to content

43 - Basic commands

Basic commands provide several possibilities for investigation and therefore knowledge of their use is important. Kybereo virtual machine is using Centos 8.0 operating system, so you can look Centos system command guide for more information on commands.

Linux commands

SUDO - is command that allows users to run programs with the security privileges of another user, by default the superuser. This is needed if you use linux with basic user. Example nmap command don't work on kali, because we are logged in on basic user account. sudo will first ask root account password and then it gives command results.

MAN and HELP - Man formats and displays the on-line manual pages. If you specify section, man only looks in that section of the manual. name is normally the name of the manual page, which is typically the name of a command. There is two different ways to use help file. Example commands man ip and ip --help will show help file how to use this command.

NETSTAT - Netstat is a command line utility that can be used to list out all the network connections on a system. It lists out all the tcp, udp socket connections and the unix socket connections.

HOSTNAMECTL - Hostnamectl command provides a proper API used to control Linux system hostname and change its related settings. The command also helps to change the hostname without actually locating and editing the /etc/hostname file on a given system.

FIND and GREP - Find searches a given directory structure for a named string and displays pertinent results. Grep searches the named input files or folders for lines containing a match to the given pattern. Main difference with these two is that find is for searching files and grep is for searching string.

CAT - Cat command allows us to create single or multiple files, view contain of file, concatenate files and redirect output in terminal or files

CUT - Cut command in UNIX is a command for cutting out the sections from each line of files and writing the result to standard output. It can be used to cut parts of a line by byte position, character and field. Basically the cut command slices a line and extracts the text.

LESS and MORE - More and Less commands is linux utility which can be used to read contents of text file one page(one screen) per time. It has faster access because if file is large, it don’t access complete file, but access it page by page. More and less have the option to view multiple files at once. more allows us to view them as a single file separated by lines, and less allows us to switch between them. However, both more and less display all the opened files with the same options.


Try these commands on Kybereo virtual machine

  • netstat
    • it will show network connections information
  • hostname
    • it will give all information related hostname
  • find / -name log
    • it will make search on root folder and will find files and folders which contains specific word log
  • find / -name log*
    • asterisk mark will show all files and folders which includes word log
  • man find
  • find --help
  • cat /var/log/httpd/error_log
    • command will displays all the contents of the file error_log
  • grep notice /var/log/httpd/error_log
    • command will displays all the lines, which includes word notice (highlighted) of the file error_log
  • cut -b 2-4,6-8 /var/log/httpd/error_log
    • b option extracts specific bytes on file
  • more -p /var/log/httpd/ssl_error_log-20201126
    • more shows data page by page and possible to abort letter q

Piping in Linux

Pipe is used to combine two or more commands, and in this, the output of one command acts as input to another command, and this command’s output may act as input to the next command and so on. Example if we try command netstat, we cannot see all data, because page is so long. If we use netstat | more it will show information one page at time (hit any button to change next page).

Try these commands on Kybereo virtual machine

  • netstat | more
  • cat /var/log/httpd/error_log | head -7
  • cat /var/log/httpd/error_log | tail -5
  • cat /var/log/httpd/error_log | head -7 | tail -5
    • This command select first 7 lines through (head -7) command and that will be input to (tail -5) command which will finally print last 5 lines from that 7 lines.

Linux logs

Kybereo virtual machine uses Centos operation system, so all logs can be found on path: /var/log/. All webserver log files can be found folder /var/log/httpd/.


Basic of wordpress usage

Wordpress admin page can be found at https://www.kybereo.ch/wp-admin/. Another way to login is on main page https://www.kybereo.ch/ click intra and log in (management bar on top page).

img/wp-admin-page.png

Reminder: Wordpress includes two different sites: Kybereo website and intra! img/wp-dashboard.png