Shell:
the shell is a program that takes your commands from the keyboard and gives them to the operating system to perform.
Steve Bourne invented the shell, so its name is Bourne shell.
An enhanced version of Bourne shell is “Bourne Again SHell” (Bash).
xterm, rxvt, konsole,kvt, gnome-terminal, nxterm, and eterm. These all are terminal emulators that put a window up and let you interact with the shell.
Tree:
In windows, different partitions have different letters (C:, D:), hence different trees.
In Linux, only one tree, the first directory is the root directory “/”
Using the “mount” command, each partition is assigned to a certain path into this unique tree.
In Linux, only one tree, the first directory is the root directory “/”
Using the “mount” command, each partition is assigned to a certain path into this unique tree.
Shell Commands:
pwd: print working directory
ls: list all the files and directories
|
List the files in the working directory
|
ls /bin
|
List the files in the /bin directory (or any other directory you care to specify)
|
ls -l
|
List the files in the working directory in long format
|
ls -l /etc /bin
|
List the files in the /bin directory and the /etc directory in long format
|
ls -la ..
|
List all files (even ones with names beginning with a period character, which are normally hidden) in the parent of the working directory in long format
|
cd “path”: change working directory to “path”
- cd: change working directory to “home directory”, which is usually “/home/your_user_name”
- cd .. : change directory to the parent directory
- cd ~user_name: change working directory to the home directory of this user.
|
Scroll back one page
|
Page Down or space
|
Scroll forward one page
|
G
|
Go to the end of the text file
|
1G
|
Go to the beginning of the text file
|
/characters
|
Search forward in the text file for an occurrence of the specified characters
|
n
|
Repeat the previous search
|
q
|
Quit
|
ln: create a symbolic link file
a symbolic link file is a file that points to another file
Ex: ln [OPTION]... TARGET [LINK_NAME]
a symbolic link file is a file that points to another file
Ex: ln [OPTION]... TARGET [LINK_NAME]
File/Dir Commands:
IO redirection:
Redirect the output to a file:
- “>” to overwrite
- “>>” to append
Redirect output to be input of a command:
- “|”: pipe. The following commands (Filters) are commonly used with pipes
- sort: sort the lines of the input alphabetically
- uniq: remove duplicate lines from input
- fmt: format the input into neat paragraphs
- pr: split the input into pages
- lpr: send the input to the printer
Permissions:
- Permissions:
- chmod: modify file access rights
- chmod 644 filename_or_directoryname
- 6 4 4: 110 100 100: rw- r-- r--: owner can read and write - grp and others can read only
- su: temporarily become the superuser (superuser can change the file owner)
- sudo: Super User Do command:
- sudo stop lightdm: exit the X server
- sudo start lightdm: start the X server
- ctrl+alt+F1: Go to terminal
- ctrl+alt+F7: Go to X server
- chown: change file ownership
- chgrp: change a file's group ownership
Ex on file permissions:
- type: less -l /bin/bash.exe
you will get the following line on the shell:
-rwx------ 1 Ahmad UsersGrp 651264 Sep 6 16:11 /bin/bash.exe
permissions |owner | owner group | | modification date|file name
Job Control:
- ps: list the processes running on the system (like: ctrl+alt+del)
- kill: send a signal to one or more processes (usually to "kill" a process)
- jobs: an alternate way of listing your own processes
- bg: put a process in the background
- Ex: how to kill a process:
- get the process PID through ps command
- type: kill pid
- if still not killed use: kill -SIGKILL pid
No comments:
Post a Comment