LINUX COMMAND
SNO
1
COMMAND
ls
DESCRIPTON
Short listing of directory contents
-a list hidden files
-d list the name of the current directory
-F show directories with a trailing '/'
executable files with a trailing '*'
-g show group ownership of file in long listing
-i print the inode number of each file
-l long listing giving details about files and directories
-R list all subdirectories encountered
-t sort by time modified instead of name
ll
list show in vertical.
pwd
It prints the current directory name with the complete path starting
from root (/)
su
'su' is used to switch from one account to another.
hostname
It is used to show or set a computer's host name and domain name
cd
change directory
cd ..
The directory one level up from the current directory
ping
check destination host reachable
Ex: Ping 192.168.1.10
Ping hostname
mkdir
mkdir is used to create directories on a file system
10
mkdir -p
mkdir is used to create directories on a file system with
subdirectries
11
rm
The command which is used to remove or delete files in directory is
the rm command. It can be used in many ways and has many optional
formats. The syntax of this command is as follows:
1.-R: How to Remove Files and Subdirectories Recursively in
Unix(RM -R FOLDERNAME).
2.-F: How to Remove the Files Forcefully in Unix(RM -F
FOLDERNAME)
3.Combining Options : rm -rf(RM -RF FOLDERNAME)
12
neat
Neat is a GNOME GUI admin tool which allows admins to specify
information needed to set up a network card, among other features.
Setting up an NTL Cable Modem using neat.
Where neat falls in when building a network between Unix and Linux
systems.
13
service network
restart
To restart the network services.
14
chkconfig
sendmail off
To disable the sendmail service.
15
chkconfig
sendmail on
To enable the sendmail service.
16
uname -a
The uname command is use to print out system information on Linux
machine
17
mv
The mv command is used to move or rename files.mv (short for
move) is a Unix command that moves one or more files or directories
from one place to another. If both filenames are on the same
filesystem, this results in a simple file rename; otherwise the file
content is copied to the new location and the old file is removed.
Ex: 1. mv file file1
# renames 'file' to 'file1'.
2. mv file /file
# moves 'myfile' from the current directory to
user's home directory.
18
cp -pr
cp is a UNIX command for copying files and directories. The
command has three principal modes of operation, expressed by the
types of arguments presented to the program for copying a file to
another file, one or more files to a directory, or for copying entire
directories to another directory.
p (preserve) the p flag preserves the following characteristics of
each source path in the corresponding target: the time of the last data
modification and the time of the last access, the ownership (only if it
has permissions to do this), and the file permission-bits.
V (verbose) - the verbose option simply produces verbose output on
your screen. it means that the program provides comments on the
operation as they occur, so you will see real-time status of what the
utility or program is doing to run the tasks or commands you sent.
19
scp -pr
scp stands for "secure copy." If you are familiar with using
the cp command on your local machine, scp is easy to
understand. Both commands require a source and a
destination filesystem location for the copy operation; the
big difference is that with scp, one or both of the locations
are on a remote system.
Syntax: scp -pr <file>
[email protected]:/oracle/dump
20
vi (VIsual text Insert text
:wq!-save(w) & quit, :q!- quit.
editor)
21
cat
The 'cat' command is used to display text files. It can also be used for
copying, combining and creating new text files.
To create a new file, use the command
1. cat > filename
2. Add content
3. Press 'ctrl + d' to return to command prompt.
To view a file, use the command >> cat filename
22
more
'more' is a command to view (but not modify) the contents of a
text file one screen at a time.
23
date
It is used to display Date and Time
24
df
The df command displays the information of device name, total
blocks, total disk space, used disk space, available disk space and
mount points on a file system.
-k Use 1024-byte units, instead of the default 512-byte units, when
writing space figures.
-P Use a standard, portable, output format.
-t If XSI compliant, show allocated space as well. (file system
type)
-h Display in KB, MB, or GB .
25
chown
Transfers the ownership of a file to the user with the specified user
name
-R Changes files and directories in all subdirectories.
26
chmod
Changes the access permissions.
The access type is controlled by the following options:
r read
w - write
x - eXecute executing files or changing to the directory.
0 --> No Permission
1 --> Execute
2 --> Write
3 --> Execute + Write
4 --> Read
5 --> Read + Execute
6 --> Read +Write
7 --> Read + Write +Execute
User Denotations
u --> User / Owner
g --> Group
o --> Other
27
head
Prints the first several lines of each specified file
EX: head filesname
28
man
Man stands for manual which is a reference book of a Linux
operating system. It is similar to HELP file found in popular
softwares.
To get help on any command that you do not understand, you can type
29
history
History command shows all the commands that you have used in
the past for the current terminal session. This can help you refer to
the old commands you have entered and re-use them in your
operations again.
30
Clear
This command clears all the clutter on the terminal and gives you
a clean window to work on, just like when you launch the terminal.
31
ssh
It is used to securely connect to a remote computer. Loign to One
system to another system.
Ex: ssh hostname (or) Ipaddress
32
top
This utility tells the user about all the running processes on the
Linux machine.
33
free
This command shows the free and used memory (RAM) on the
Linux system.
Ex:
free -m to display output in MB
free -g to display output in GB
34
ps
Give the status of processes running for a user
35
kill
Kills a process
Ex: kill -9 ProcessID
36
whoami
Displays the name of the user who runs the command.
37
Init 0
Shutdown system
38
Init 6
Restart system
39
Passwd
To change password
40
ls -lrt
It displays complete file and folder details
41
Xhost +
Turns off acccess control (all remote hosts will have access to X
server)