Linux Module Commands
Linux Module Commands
Day -1
Linux
[sdbt ~]$ w
15:32:01 up 5:12, 4 users, load average: 0.42, 0.53, 0.50
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
oracle tty1 :0 10:20 5:12m 11:40 0.02s pam: gdm-passwo
oracle pts/0 192.168.1.17 14:20 13:13 0.09s 0.03s /bin/bash
sdbt pts/1 192.168.1.5 14:37 1:21 0.03s 0.03s -bash
sdbt pts/2 192.168.1.5 15:06 1.00s 0.04s 0.00s w
-h skip header
-l long listing (default)
-s short listing
-u ignore uid of processes
-V display version
System Basic Command
id
Print user and group information for the specified IDs.
[sdbt ~] id
uid=2028(jlaxmi) gid=2028(jlaxmi) groups=2028(jlaxmi),54321(oinstall)
[sdbt ~] users
[sdbt ~] groups
sdbt oinstall
example
alias name=value
[sdbt ~]$ alias clr=clear
File systems
ordinary file
directory file
executive file
File Commands
[
File Commands
pwd
print name of the current working directory.
[sdbt ~]$ ls
Desktop Downloads oradata script
admin check.sh dir1 log
Pictures Templates arch create
Documents Music Public test
[sdbt ~]$ cd /
[sdbt ~]$ dir
archive backup etc media pgarchive slave_arch usr
archive9_6 bin home misc postdumps slave_Arch v1
asmdisk1 boot lib mnt proc soft v2
asmdisk2 cgroup lib64 net root srv var
asmdisk3 data lost+found opt sbin sys
asmdisk4 dataold master oracle selinux tmp
cat file1 > file2 #File1 output stored in another file2 file
[sdbt ~]$ cat >> file1.txt #To append the exist file
Linux is user for servers
linux is fast and secure
Its acts has multi user platforms
[sdbt ~]$ cat file1.txt > file2.txt #To divert output in another file
[sdbt ~]$ cat -vET 1.txt #To view the file contents
arch$
awk$
alias$
File Commands
tac
concatenate and print files in reverse.
command mode
filename
cursor
point
File Commands
Insert mode
insert
allowed
cursor
point
File Commands
Escape mode
Esc
mode
File Commands
Command mode
1G - Move Cursor into First Line of the File
nG - Move Cursor into nth Number of the Line in File
G - Move Cursor into Last Line of the Line in File.
yy - Copy a Single line.
nyy - Copy Multiple line.
dd - Delete a Single Line.
ndd - Delete Multiple Line.
dw - Delete Single word.
x - Delete a Single character.
r - Replace a Single Character.
R - Replace a Multiple Character.
p - Paste the deleted or copied information.
u - Undo the changes
k - Move the cursor upward.
j - Move the cursor downward.
h - Move the cursor left side.
l - Move the cursor right side.
File Commands
Insert mode
i - allow insert cursor location.
I - allow insert start line of cursor location.
a - allow insert next to cursor location.
A - allow insert end line of cursor locaion.
o - open a new line below and allow insert from the cursor location.
O - open a new line above and allow insert from the cursor location.
Escape mode
Esc + :
w -Save
q -Quit
! -Force
n -next
/string -Search string in file
rew -review the multiple file once more
File Commands
ed
ed is a line-oriented text editor.
top
bottom
File Commands
mkdir
Create a Directory
-f force
-r recursive
more
Filter for paging through text one screenful at a time.
less
less similar to more but allows backwared and forward movement.
nl
number lines of file
sort
sort lines of text files.
uniq
Filter adjacent matching lines.
animals
fruits
vechicles
vegetables
wechicles
File Commands
comm
Compare sorted files file1 and file2 line by line
animals
animals
birds
fruits
fruits
vechicles
vegetables
wechicles
File Commands
diff
Compare files line by line
diff3
Compare three files line by line
cmp
compare two files byte by byte.
-l lines
-w words
-c bytes
File Commands
cp
Copy files and directories
[sdbt~]$ ls -lrt|tail -3
-rw-rw-r-- 1 sdbt sdbt 18 Jul 4 13:19 xac
-rw-rw-r-- 1 sdbt sdbt 30 Jul 4 13:19 xab
-rw-rw-r-- 1 sdbt sdbt 30 Jul 4 13:19 xaa
File Commands
paste
Merge line of files
-a - --all Scan the entire file, not just the data section
-f --print-file-name Print the name of the file before each string
-n --bytes=[number] Locate & print any NUL-terminated sequence of at
-<number> least [number] characters (default 4).
-t --radix={o,d,x} Print the location of the string in base 8, 10 or 16
-o An alias for --radix=o
-T --target=<BFDNAME> Specify the binary file format
-e --encoding={s,S,b,l,B,L} Select character size and endianness:
s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit
@<file> Read options from <file>
File Commands
tee
tee command reads the standard input and writes it to both the standard output and one or more
files. The command is named after the T-splitter used in plumbing. It basically breaks the output of a program
so that it can be both displayed and saved in a file.
[sdbt ~]$ ls -l|grep sdbt> newfile.txt [sdbt ~]$ ls –l | grep whale | tee newfile.txt
-rw-r----- 1 sdbt sdbt 16071 Jun 19 17:02 whale
[sdbt ~]$ cat newfile.txt
-rw-rw-r-- 1 sdbt sdbt 692 Jul 11 10:50 sdbt [sdbt ~]$ cat newfile.txt
-rw-rw-r-- 1 sdbt sdbt 0 Jul 9 12:58 sdbt00 -rw-r----- 1 sdbt sdbt 16071 Jun 19 17:02 whale
-rw-rw-r-- 1 sdbt sdbt 22 Jul 9 12:58 sdbt01
-rw-rw-r-- 1 sdbt sdbt 35 Jul 9 12:58 sdbt02 [sdbt ~]$ date | tee newfile.txt
-rw-rw-r-- 1 sdbt sdbt 36 Jul 9 12:58 sdbt03 Wed Jul 11 10:55:20 IST 2018
-rw-rw-r-- 1 sdbt sdbt 279 Jul 9 12:58 sdbt04
[sdbt ~]$ cat newfile.txt
Wed Jul 11 10:55:20 IST 2018
File Commands
unexpand
Convert blanks in each FILE to tabs, writing to standard output.With no FILE, or when FILE is -, read
standard input. Mandatory arguments to long options are mandatory for short options too.