2. SOME BASIC COMMANDS
ls - directory or dir*
ls –l - Directory listing with long filenames, owner, and permissions
ls –a – show the hidden file
ls –ll -show the directory files
w –save exit
q –without save exit
wq –save and exit
wq! –forcefully exit.
ls –ld - Show only the directories matching the search
ls – r - Show subdirectories also ( just like dir /s )
ls –sharl – sort by size, all files, including hidden
ls –lart – sort by date, reverse order (newest @ the bottom of list)
-s - sorts by size, largest first
-r - reverses any sort command, i.e. ls –rS sorts smallest first
-t - sorts by modification time, recent first
-u - sort by last accessed time
-x - sort by file extension
3. Linux Commands
#pwd -print working directory
will show you the full path to the directory you are currently in.
# shred - overwrite a file to hide its contents
The result is that your file is so thoroughly deleted it is very unlikely to
ever be retrieved again.
# ln s - test symlink
Creates a symbolic link named symlink that points to the file test
# free -Displays the amount of used and free system memory.
4. Linux Commands
w – show who is logged on and what they are doing
usage: w
who –show who is logged in
usage: who
who b> - last system boot time
whoami – prints the effective user id.
whereis ls -Locates binaries and manual pages for the ls command.
cat – displays the contents of the file on the screen.
5. Linux file system
First let see file structure in Linux :-
1) Standard directory structure
/ - the topmost ( / means where the file system is stored like C: in windows )
/dev - all the devices are accessible as files
/var - “variable” data such as mails, log files, databases
/usr - almost all the packages installed
/etc - configuration files
/home - home directories for all the users
/root - home directory of the privileged user root
/mnt - used to mount other directories/partitions.
6. Linux file system
# rm it is used to delete files
&
# rm -r it is use to delete directorys recursively
usage : $ rm -r /root/folder
# mkdir it is used to create directory (folder)
usage : $ mkdir /etc/folder
# touch it is used to create files
usage : $ touch /root/temp
7. PERMISSION
• u - User who owns the file.
g - Group that owns the file.
o - Other.
a - All.
r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.
• Read –r-4 Permission –read- (rwx)=7
• Write –w-2 Permission – write- (r-x)=5
• Execute-x-1 Permission-execute-(-wx)=3
8. PERMISSION
Permissions:chmod 777 file.htm
CHMOD can also to attributed by using Numeric Permissions:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
Examples
The above numeric permissions can be added to set a certain permission,
for example, a common HTML file on a Unix or Linux server accessible
over the Internet would be given the below permissions.
9. PERMISSIONS
• chmod 644 file.htm
• This gives the file read/write by the owner and only read by everyone else (-rw-r--
r--).
• Files such as scripts that need to be executed need more permissions. Below is
another example of a common permission given to scripts.
• chmod 755 file.cgi
• This would be the following 400+040+004+200+100+010+001 = 755 where you are
giving all the rights except the capability for anyone to write to the file.cgi file(-
rwxr-xr-x).
• chmod 666 file.txt
• Finally, another common CHMOD permission is 666, as shown below, which is
read and write by everyone.
• Tip: The above commands are all done through the command line. However, if you
upload a file using FTP these permissions can also be adjusted through many FTP
clients by right-clicking the file and choosing permissions.
10. HOW CAN CHANGE THE TEMPORARY “HOSTNAME” SETTING
#hostname
#hostname station.example.com
#hostname //check it
#station //setting temporary hostname
HOW CAN CHANGE THE PERMANENT “HOSTNAME” SETTING
# vi / etc/sysconfig/network/
#HOSTNAME=station.example.com
#service-config-network
#service network restart
#clear
11. THIS IS NEW COMMANDS
IF YOU WANT SEE THE CURRENT DATE
#date +”%D%H:%M:%S”
IF YOU WANT TO PRINT ANY MESSAGE
#echo “WELCOME TO VOLKSGEIST TECHNOLOGIESE”
BASIC COMMAND
#/ dev /fdo //flopy drive (A)
#/dev /fd1 //flopy drive (B)
#/dev /had //master drive on primary
#/dev /hda1 //1-partition
#/dev /hda3 //save drive
#/dev /hdc //master drive secondry
#/dev /hdl //save drive secondry
12. PERMISSION DISTRIBUTE SIZE
The 100 are for the OWNER of the file
400 –read
200 –write
100 –execute
There are for Groups of the file
40 –read
20 –write
10 –execute
There are for every one else
3 –read
2 –write
1 -execute
13. CREATE MACHINE FOR COMMUNICATE
CLIENT
CLIENT
SERVER
SERVER
#hostname server.example.com #hostname client.example.com
Ip address-172.24.16.2 Ip address-172.24.16.3
RAM-1024 RAM-512
HDD-80GB HDD-80GB
Ping-127.24.16.3 Ping-127.24.16.2