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

01 Access Linux File System

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

01 Access Linux File System

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

Access Linux File System

Linux
● Open-source
● Unix-like OS kernel
● Started by Linus Torvalds in 1991 as a
personal project
● Global developer collaboration led to
widespread adoption

Tux Source:https://greencloudvps.com/linux-distributions-e
verything-you-need-to-know.php
● Official mascot created by Larry Ewing
● Represents coolness and stability
Features of Linux

Source: Features of Linux Operating System - Naukri Code 360


Basic linux commands
● whoami ● more
● man ● head
● —help ● tail
● whatis ● echo
● pwd ● sed
● mkdir ● awk
● cd ● which
● fdisk -l ● stat
● less ● history
Get current user name
● Command: whoami

Display manual pages for a command


● Command: man <command>
Get information on a command's usage, options, and syntax.
● Command: <command> –– help

Get a one-line description of any command


● Command: whatis <command>
Get current directory path
● Command: pwd

Create a directory and then verify it using ‘ls’ command


● Command: mkdir <directory-name>
To change the current working directory
● Command: cd <directory-name>

Change directory to parent directory


● Command: cd ..
Stay in current directory
● Command: cd .

Change directory to home directory


● Command: cd ~
List all the disk partitions
● Command: fdisk -l
View the content, one page at a time
● Command: less </path/to/file>
View content of a file one screen at a time
● Command: more <file-name>
Head:
● Used to display starting lines of a file
● By default it shows the first 10 lines
● -n option specifies how many lines to display
● Command: head -n 5 <file-name>
Tail:
● Displays last lines of file
● By default shows last 10 lines of file
● -n option specifies how many lines to display
● -f option can be used to keep tail command running and display new
lines as they are appended to the file
● Command: tail -n 5 <file-name>
echo:
● Used to print text to terminal
● Command: echo <text>

● ‘>’ redirects output into a file


● Takes output from echo (left) and redirects it to myfile.txt (right)
● Command: echo 'This is a sample text' > <file-name>
Find and replace text within a file
● Command: sed -i 's/{old_text}/{new_text}/' <file-name>
awk:
● Text processing tool
● Used for pattern scanning and processing in files or streams
● -F option allows setting a custom field delimiter with whitespace as
the default
● Transform files and produce formatted output lines
● Command: awk -F: '{print $1}' <file-name>
Find the full path of the bash shell
● Command: which bash

List previously executed commands in the current session.


● Command: history
Display detailed information about the file: file name , permissions and
timestamps
● Command: stat <file-name>

You might also like