Sobes.tech
Junior

What administrative commands do you know in Linux?

sobes.tech AI

Answer from AI

  • ls - view directory contents
  • cd - change current directory
  • pwd - display full path to current directory
  • mkdir - create a new directory
  • rmdir - delete an empty directory
  • rm - delete files and directories (with options)
  • cp - copy files and directories
  • mv - move/rename files and directories
  • cat - display contents of text files
  • less / more - paginated view of file contents
  • head - display the beginning of a file
  • tail - display the end of a file
  • grep - search for lines matching a pattern
  • find - search for files based on various criteria
  • echo - output a string to standard output
  • man - display help information about a command
  • sudo - execute a command with superuser privileges
  • chown - change file/directory owner
  • chgrp - change group owner of a file/directory
  • chmod - change access permissions of a file/directory
  • ps - view list of running processes
  • top - interactive system process monitor
  • kill - terminate a process by PID
  • df - display free disk space information
  • du - estimate disk space used by files/directories
  • free - information on RAM usage
  • ping - check network connection
  • ssh - remote connection to a server
  • scp - copy files between servers over SSH
  • wget / curl - download files from the internet
  • tar - work with archives (create, extract)
  • gzip / bzip2 - compress/extract files
  • systemctl - manage services (systemd)
  • journalctl - view system logs (systemd)

Examples of using some commands:

# List files in the current directory with detailed info
ls -l

# Create a directory named 'my_project'
mkdir my_project

# Copy 'config.ini' to the 'backup' directory
cp config.ini backup/

# Move 'script.py' to the 'bin' directory and rename it to 'run_script'
mv script.py bin/run_script

# Find all '.log' files in the current directory and subdirectories
find . -name "*.log"

# Change owner of 'data.txt' to user 'admin'
sudo chown admin data.txt

# Check the status of the apache2 service
systemctl status apache2