Skip to content

Basic Linux Commands

avvcodes edited this page Apr 15, 2022 · 1 revision

Linux Commands

  1. sudo apt update && sudo apt install terminator (this is for different command line in ubuntu)

  2. cat .bash_history (to see history of commands you typed)

  3. echo $HISTFILESIZE (2000 commands can be written/store)

  4. history (history of commands can show 1000 commands)

  5. echo $HISTSIZE (gives 1000 , which represents 1000 commands can be in history)

  6. linux commands are case sensitive (small & capital letter can be treated differently)

  7. history (gives list of commands then you can run any command based on number ! number see below image)

  8. image this is to run commands based on history command number

  9. !! (for recent command)

  10. !-2(from below commands list,it will execute 3rd command)

  11. history -d 12 (deletes the command on line number 12)

  12. history -c (deletes all commands)

  13. put a space infront of a command it won't store that command in history (it applies only for ubuntu )

  14. echo $HISTCONTROL (command controls the characters of history)

  15. ping -c 1 8.8.8.8 (to check internet connection, it will ping google server, here 1 means send 1 packet to dns)

  16. ls (to list files)

  17. ls -l /etc/ (-l means long list of files in folder etc)

  18. ls -a OR ls --all (gives list of all files including hidden files)

  19. ls -lh --all /var/ (you can cobine multiple letters together -l -h -a or -lah, h is for short format)

  20. df (disk space in filesystem)

  21. man COMMAND NAME (gives manual for command)

  22. man cat (controls- move up and down arrows, forward ctrl+f, backward ctrl+b , g upper end, G lower end, h for help, search by using /search term, n next , shift+n backwards search terms)

  23. to check command is executable or not, using type COMMAND_NAME

  24. cd --help, ls --help

  25. man -k "ifconfig" and man -k "copy files" (searches for the words in manuals) image

  26. Ctrl+L clears the screen in terminal

  27. Ctrl+A to move cursor to start of the line, Ctrl+E to the end

  28. adding date and time to history image

Clone this wiki locally