Linux Directory
When we enter the linux world, we will face a different dimension (from windows). And if you want to get used to linux as fast as possible there's nothing less then learning this 3 things. In the linux file manager we will see a lot of directory/folder and some of it (the most important) you need to know is in the list below:
1. / “Root” the top of the file system hierarchy.
2. bin Binaries and other executable programs.
3. etc System configuration files.
4. home Home directories.
5. opt Optional or third party software.
6. tmp Temporary space, typically cleared on reboot.
7. usr User realated programs.
8. var Variable data, most notably log files.
If i draw it to the picture then it could be like this:
Command Line
In linux we should get in touch with Command Line (latter we call it SHELL), because GUI is not the king in linux there is so much limitation we have when we using GUI.
Command line is text based interface where we type command and get direct text input and output to screen/files/other program.
Linux SHELL
The SHELL is default user interface to LINUX (SERVER), it started in 1971 by Thompson Shell for UNIX environment. On the GUI based linux (desktop) you could use the TERMINAL. Common Linux now days use BASH SHELL (Bourne Again Shell) as it is SHELL development.
SHELL - Prompt
When the shell started its showed prompt by default.
The Prompt example:
farihin@farihin-server:~$
root@farihin-server:~#
The promp give you some information, like the example above:
farihin/root = username currently used
farihin-server = hostname/computer name
$ = using shell as normal user
# = using shell as super user (root)
~ = showing home/parent directory
root folder and root user is different thing.
General Command Syntax
In SHELL there will always 3 sequence to use, first command, two options, and three arguments.
- Command is the program you’re running.
- Options tell the program how to operate (start with dash (-) & usually one letter).
- Argument(s) tell the command what to operate on (usually path/file).
cat [filename] =Display file’s contents to the standard output device (usually your monitor).
cd /directorypath = Change to directory.
chmod [options] = mode filename Change a file’s permissions.
chown [options] filename = Change who owns a file.
clear = Clear a command line screen/window for a fresh start.
cp [options] source destination = Copy files and directories.
date [options] =Display or set the system date and time.
df [options] =Display used and available disk space.
du [options] =Show how much space each file takes up.
file [options] filename =Determine what type of data is within a file.
find [pathname] [expression] =Search for files matching a provided pattern.
grep [options] pattern [filesname] =Search files or output for a particular pattern.
kill [options] pid =Stop a process. If the process refuses to stop, use kill -9 pid.
less [options] [filename] =View the contents of a file one page at a time.
ln [options] source [destination] =Create a shortcut.
locate filename = Search a copy of your filesystem for the specified filename.
lpr [options] Send a print job.
ls [options] List directory contents.
lsman [command] =Display the help information for the specified command.
mkdir [options] directory =Create a new directory.
mv [options] source destination =Rename or move file(s) or directories.
passwd [name [password]] =Change the password or allow (for the system administrator) to change any password.
ps [options] Display a snapshot of the currently running processes.
pwd Display the pathname for the current directory.
rm [options] directory Remove (delete) file(s) and/or directories.
rmdir [options] directory Delete empty directories.
ssh [options] user@machine =Remotely log in to another Linux machine, over the network. Leave an ssh session by typing exit.
su [options] [user [arguments]] Switch to another user account.
tail [options] [filename] Display the last n lines of a file (the default is 10).
tar [options] filename Store and extract files from a tarfile (.tar) or tarball (.tar.gz or .tgz).
top Displays the resources being used on your system. Press q to exit.
touch filename Create an empty file with the specified name.
who [options] Display who is logged on.
Post a Comment