Linux Commands Flashcards
$ exit
closes the terminal emulator window
$ date
displays the current time and date
$ cal
displays a calender of the current month
$ pwd
prints full path of current working directory
$ cd
changes directory (to root without giving pathname)
$ ls
lists directory content
$ cd /some/path/name
$ cd ~/some/path/name
changes directory by given absolut path, which starts with the root “/” or with ~ as representation of the root followed by some directories
.
..
one dot represents the current working directory
two dots represent the parent directory of the current working directory
- absolute pathname
2. realtive pathname
- an absolute pathname starts from the root directory /
- a relative pathname starts from the working directory . /
In almost all cases, we can omit the ./ part because it is implied because ./ means the working directory, but we start a relative part always from the working directory. Simply wrinting “ cd name_of_subdirectory” is enough.
How can you see hidden files?
Filenames that begin with a period character are hidden. This means that “ls” will not list them unless you enter “ls -a”.
How should filenames be written in Linux?
Filenames and commands in Linux are case sensitive. Most important, do not embed spaces in filenames. If you want to represent spaces between words in a filename, use underscore characters. File extensions are not necessary.
$ cd -
changes the working directory to the previous working directory
$ cd ~user_name
changes the working directory to the home directory of user_name
$ ls
lists content of working directory
$ ls /some/path/name
lists the content of the directory, specified by this pathname, without changing the current working directory
$ ls -l
lists the content in long detailed form of the working directory
- $ ls -lt
2. $ ls -lt –reverse
- lists the content in long detailed form “-l” and sorts the content by the modification time “-t” of the current working directory
- reverses the order of the sorted content
$ ls -a (–all)
lists all files, even those with names that begin with a period, which are normally not listed (that is, hidden)
$ ls -A (–almost-all)
lists like the -a option hidden files except it does not list .(current directory) and ..(parent directory)