essentials
In this section, I will be discussing some basic Linux commands, along with a few basic flags associated with each commands. The term flag refers to the arguments/parameters supplied to the command.
apt, apt-get, file, diff
ls
Lists contents in specified directory. If <dir> value is omitted, the current directory would be used instead
$ ls <dir>
Desktop Downloads Documents
Public Pictures ...
Useful flags
-l
To display content in long listing format
$ ls -l
-a, --all
To display all content including those starting with . (hidden files)
$ ls -a
Combination of multiple flags
Display all content including hidden files (starting with .), in long listing format
$ ls -la
pwd
To print the current working directory
user@linux:~/$ pwd
/home/user
cd
To change directory
$ cd <dir>
Basic example
# print the current working directory
user@linux:~/$ pwd
/home/user
# change directory
user@linux:~/$ cd test_dir
# pwd displays the updated directory
user@linux:~/test_dir$ pwd
/home/user/test_dir
mkdir
To create a new directory
$ mkdir <new_dir>
# example
user@linux:~/$ mkdir test_dir
user@linux:~/$ cd test_dir
user@linux:~/test_dir$
cat
From manpage: "concatenate files and print on standard output". In simple terms, it displays the content of a particular input file
$ cat test_file.txt
here is a test file
next line here
Useful flags
-n, --number
To display output line numbers
$ cat -n test_file.txt
1 here is a test file
2 next line here
$ cat ---number test_file.txt
1 here is a test file
2 next line here
Last updated