BASIC Linux Commands for Beginners

Recently I have start working on Linux for various reasons office and personal. What I noted is that I always forget the basic commands. Here are few commands I think valuable to remember, Hope this will help someone else too..

Find the commands using commands

  • apropos [keyword] – get all commands relate to a keyword
  • man [command name] – description of the command

Basics

  • pwd – What path you are in
  • ls – list of files and folders
  • ls -a – list of files and folder including hidden file/folders
  • ls -l – show addition detils of folders and files ex : file permissions
  • cd – move into a directory
  • cd .. – move out of a directory
  • mkdir – make directory
  • cd / – move to a root directory
  • cd ~ – go to home directory
  • clear – clear terminal

File Open and Editing

  • touch – create a file (touch file.txt)
  • nano – command based text editor (if not installed apt-get install nano)
  • save(nano) – Ctrl+O
  • cat – shows inside a file (smaller files)
  • less – show inside a file (large files)
  • mv – move files (mv file.txt ./testdir/file2.txt
  • cp – copy file content / files
  • rmdir – remove directory
  • rm -R dir – remove directoy with files
  • which – search file or folder location

Other Commands

  • history – last 500 commands (did not work on debian but works on alpine)
  • apt-get update (update linux packages)
  • sudo – run any command with administration privilages
  • ifconfig – network details (ipconfig equilent) works only on alpine
  • iwconfig – wireless details
  • ping – ping another computer in network
  • uname -a – Linux detalils ( cat /etc/issue for docker)
  • blkid – hard drive details
  • swap – running processes and memeory usage
  • df – disk sapce
  • lsusb – divices like usb details
  • shutdown
  • su – switch user
  • lsblk – hard drive details