0% found this document useful (0 votes)
8 views

Linux

The document discusses Linux file system hierarchy, file types, and basic Linux commands for working with files and directories such as touch, rm, cp, mv, head, tail, ls, cat, pwd, cd, and man. It also covers keyboard shortcuts and control operators like semicolon.

Uploaded by

kaushik reddy
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Linux

The document discusses Linux file system hierarchy, file types, and basic Linux commands for working with files and directories such as touch, rm, cp, mv, head, tail, ls, cat, pwd, cd, and man. It also covers keyboard shortcuts and control operators like semicolon.

Uploaded by

kaushik reddy
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Kernal- in mac- XNU kernel

windows- windows NT kernel


android- linux
Shell

File System Hierarchy (FSH):-


root is main directory
/bin/
/boot/
/dev/
/etc/
/home/
/lib/
/media/
/mnt/
/opt/
/root/
/sbin/
/srv/
/tmp/
/usr/
/var/
/proc/
/lost+found/
/run/

Linux File Types:-


- regular file
d directory
c character device file
b block device file
s local socket file
p named pipe
l symbolic link

Command Line:-

working with files and file contents:-


TOUCH:-
to create files:-
touch filename (single file) touch filename.txt/.mp3
touch filename{1..5} (multiple files) touch filename{1..5}.txt/.mp3
change modification time of files:-
touch -am filename
display type of file:-
file filename

RM:-
to remove files and directories
rm filename (permanently deletes not in recycle bin)
rm -i filename (sends to recycle bin)
rm-rf (deletes directories or delete forcefully)

CP:-
to copy file
cp filename path ex: cp file1 sample/
cp -i (to prevent cp from overwriting existing files)

MV:-
two uses
to move file
mv filename path EX: mv file2 sample/
to rename file
mv filepresentname filenewname

HEAD:-
top lines of a file
head -10 path EX: head -10 /etc/passwd

TAIL:-
down lines of a file
tail -10 path EX: tail -10 /etc/passwd

ls shows list
clear clears terminal
ls -l shows list with details
ls -la a means shows hidden files

CAT:-
to read file
cat filename
to create new file and write in it
cat > newfile.txt
to stop writing and exit
control+c
or
cat > newfile.txt <<stop (to stop writing and exit type stop)

to open any file


cat path Ex: cat /etc/passwd

working with directories:-

pwd (print working directory) shows present directory


cd (change directory) to change the directory
cd ~ shortcut to go to home directory
cd .. to go to parent directory

man pages:-
man command/toolname
it is basicaly a manual consists details of the command/toolname
to exit press q

Special Keys strokes:-


ctrl+A moves the cursor to the beginning of the line
B moves the cursor backward one character
C cancels the currently running command
D logs out of the current session
E moves the cursor to the end of the line
F moves the cursor forward one character
H erase one character. similar to pressing backspace
P paste previous line
R allows you to search for a previously used command
S stops all output on-screen(XOFF)
Q loses an application window
U erases the complete line
W deletes the last word typed

Control operaters:-
multiple commands in single line

semicolon ; :-
echo abc ; echo xyz

You might also like