-
Notifications
You must be signed in to change notification settings - Fork 0
Basic Linux Commands
Linux Commands
-
sudo apt update && sudo apt install terminator (this is for different command line in ubuntu)
-
cat .bash_history (to see history of commands you typed)
-
echo $HISTFILESIZE (2000 commands can be written/store)
-
history (history of commands can show 1000 commands)
-
echo $HISTSIZE (gives 1000 , which represents 1000 commands can be in history)
-
linux commands are case sensitive (small & capital letter can be treated differently)
-
history (gives list of commands then you can run any command based on number ! number see below image)
-
this is to run commands based on history command number
-
!! (for recent command)
-
!-2(from below commands list,it will execute 3rd command)
-
history -d 12 (deletes the command on line number 12)
-
history -c (deletes all commands)
-
put a space infront of a command it won't store that command in history (it applies only for ubuntu )
-
echo $HISTCONTROL (command controls the characters of history)
-
ping -c 1 8.8.8.8 (to check internet connection, it will ping google server, here 1 means send 1 packet to dns)
-
ls (to list files)
-
ls -l /etc/ (-l means long list of files in folder etc)
-
ls -a OR ls --all (gives list of all files including hidden files)
-
ls -lh --all /var/ (you can cobine multiple letters together -l -h -a or -lah, h is for short format)
-
df (disk space in filesystem)
-
man COMMAND NAME (gives manual for command)
-
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)
-
to check command is executable or not, using type COMMAND_NAME
-
cd --help, ls --help
-
man -k "ifconfig" and man -k "copy files" (searches for the words in manuals)
-
Ctrl+L clears the screen in terminal
-
Ctrl+A to move cursor to start of the line, Ctrl+E to the end
-
adding date and time to history