Vous êtes sur la page 1sur 13

# LPIC-1 and CompTIA Linux+ Certifications Preparation:

Why Are Using CentosOS?


. Red Hat is the most popular commercial distribution
. CentosOS is nearly identical to Red Hat
. centOS is stable and secure
. CentOS is freely download

Chapter Quiz

Question: Linux was a clone of which operating system created in the 1960s? Unix
You are correct!
Linux is a replacement kernel that is able to utilize tools created for Unix. As
such entire operating systems are created around the Linux kernel and Unix tools.

# Installing Linux in a virtual machines: Virtual machines give us power to run one
operating system, inside of another, without needing to another physical machine.
. They also gives us power to save our progess in the form of a snapshots.
. Where to download: You can download virtualBox free from "virtualbox.org"
# Install virtualBox by click on the large download virtualBox icon.

. You'll see that virtualBox plateform packages come in four flavors. Windows, OSX,
Linux, and Solaris. We are using Windows, so we are going to click on the x86/amd64
link

# Virtual Machine Requirements:


. 1GB of RAM
. 5-10GB of disk space
. 64-bit virtualization environment
. CentOS ISO image

How to get CentOS ISO image: https://wiki.centos.org/Download


. Recommendations:
. 1.5GB of RAM
. 8GB of disk space
. Add additional disks later if needed

Chapter Quiz
Question:CentOS requires _____ of RAM to run well.
Answer: CentOS requires 1 GB of RAM to run well.
. According to Red Hat version 7 of Enterprise Linux requires 1 GB of ram but more
will help performance with a graphical interface.

Question: VirtualBox extensions add support for faster USB devices.


VirtualBox Extensions adds support for USB 2 and 3 devices. It also adds support
for VirtualBox Remote Desktop Protocol, Host webcam support, Intel PXE boot rom
,PCI passthrough for Linux hosts, and Disk image encryption

. Increase the memory size up to 1.5 to 2 gigs of RAM


. Virtual Hard Disk Size 18.00GB

# How to Optimize the Virtual Machine:


. In the left hand pane, click system, and near the bottom, under extended
features, we have Enable I/O APIC
. Click Processor- we can bump up the CPUs to two or three depending on what we
have.
. Enable PAE/NX is selected. This is going to allow 32 bit operating systems to
address more than 4 gigabytes of memory, and there's some other performance
features in there as well that'll make the virtual machine run little bit faster
. Acceleration: under hardware vartualization, make sure that Enable VT-X and
Enable Nested paging are both turned on. This will result in speed up in
virtualization performance

. The default for adapter one is to be attached to the NAT: This network Address
Translation. It allows our virtual machine to access the internet, but doesn't
allow someone to remotely login to in.
. For remotely login virtual machine, we'll need to change to Bridge Adapted

website for centOS ISO disc image:


https://www.centos.org
. Select DVD ISO

"F" for full screen mode


. Press number 1 and hit enter
. Press number 2 to Accept License agreements
. "C" for continue
. "C" again to continue again

# Virtualization gives us a lot of power that we don't have with physical


machines. One of those things is snapshots.
We talked about screenshots and snapshots. To do a screenshot, you do your host
key, which in my case is a right ctrl key + e, and that'll bring up a dialogue
asking where to save it.
. If we do a right ctrl key + t, it'll do a snapshot. The snapshot saves the state
of the virtual machine, that means all the installed packages and the running
applications.

Chapter Quiz
Question: Virtual machine snapshots allow us to _____ at any time.
Answer: Virtual machine snapshots allow us to "roll back to a previous snapshot"
at any time.
Hint: By clicking the VM window close gadget and selecting the Restore current
snapshot checkbox you can roll back to the snapshot.

Question: Why is it imperative to select the "make this user administrator" box
during install?"
Answer: Why is it imperative to select the "make this user administrator" box
during install?"
Hint: It allows you to log in as a user and still be able to do administrative
tasks.It's much more difficult to setup administrator access for a user after the
install.

# Update System Softoware:


One of the first things we should do after installing our operating system is
update the entire system. And Linux's software update process handles the core
operating system and any applications you may have installed.
If we do updates and one of those updates is a kernel, We'll need to reboot the
operating system.

. Go to Applications, System Tools and the very top is Application Installer. This
is a high level app store style tool, which will allow you to search for
applications in a stall.
. We have another tool that's more specific to doing software updates. Go to
Applications, System Tools and Software Update. This application gives us a lot
more details.
. we have another way of updating software via the command line. Go ahead and close
Software Update. Go to Applications, Favorites and Terminal
. To do an update we're gonna run sudo yum update. Now the sudo command is what
allows up to elevate our privileges to Administrator.
. Type "Y" and hit enter
. Now that all of our software updates are done we're gonna wanna close our
terminal window and we'll reboot. And when it comes back up we'll see the
difference and we'll create a snapshot

# Installing VirtualBox Guest Additions on Linux:


Guest Additions are pieces of software, installed in the Guest OS, that allow it
to communicate with VirtualBox better. This allows the Guest to take advantage of
faster drivers, better screen resolution, copy and paste, and shared folders.
I highly recommend installing Guest Additions, as it makes the virtual experience
smoother.

. Applications, Favorites, Terminal. In this Terminal window, we're going to


install the Development Tools Software Group. "Sudo Yum Group install Development
Tools". Sudo allows us to elevate our privileges to an Administrator, for this one
operation.
. Bring your mouse down to the bottom of the screen, and you'll see a VirtualBox
menu show up. Click on Devices, and Insert Guest Addition CD
. You may notice, if you press your Host key, +f, to go to full screen mode, that
CentOS doesn't fill the entire screen.

# Configure basic system settings:


. After we've installed CentOS, we might want to configure a few things. Click on
applications, system tools, settings. This is a general, all settings dialogue for
Gnome. In here we can change the background, sound settings, add printers and so
on. We might start out by clicking on privacy

# Customize GNOME 3 desktop: Another tool for configuring GNOME desktop is the
GNOME Tweak Tool. Click on applications, utilities, scroll to the bottom, and run
Tweak Tool. GNOME Tweak Tool allows us to change the theme, window decorations,
icons, fonts, how the keyboard and mouse operate, what happens when you push the
power button, and even what is on your top bar
# GNOME extensions:
. If we click on that it'll open up a browser and take us to the GNOME extension
website. However, before we do that we need to install a plugin. The plugin allows
the GNOME extension website to identify which version of GNOME we're using. Shrink
down GNOME Tweak Tool, go to applications, favorites, and terminal.
. Install the plugin using sudo yum install gnome-shell- browser-plugin. Type in
your password and press Y for yes. Once this is installed you can close the
terminal. Go back to GNOME Tweak Tool, click on get more extensions.

Chapter Questions:
Question: What is a major difference between GNOME 3 and other desktop operating
systems?
Answer: GNOME 3 has no application menu by default.
. Hint: Most applications are run by going into overview mode and typing the
application name. GNOME 3 does not by default have an application menu.

Question:

VirtualBox guest additions are installed in the guest OS to provide _____.

Answer: VirtualBox guest additions are installed in the guest OS to provide all of
these choices.
. Hint: VirtualBox Guest Additions are installed to provide faster drives, better
screen resolutions, and better host/client integration

# GNOME 3 overview mode:


. Most of the base features of the CentOS Desktop have been fairly standard because
Red Hat modified GNOME 3 to resemble GNOME 2, but underneath are the very powerful
features of GNOME 3.
. To demonstrate, we need to set a few things up. Make sure you're on Workspace 1,
and start up Firefox.
. Applications, Favorites, Firefox Web Browser. Now switch to Workspace 2. I'm
gonna start two applications. So go to Applications, Favorites, and Files, as well
as Applications, Favorites, and Help.
. We'll minimize that so we can see both windows simultaneously. Click on Workspace
3. Here we're gonna start our terminal, so go to Applications, Favorites, Terminal
. To switch between desktops, you can press your Windows key, and Page up and Page
down, make sure that you're in full screen mode for this to work.

# Overview:
We were able to install VirtualBox on Windows and install CentOS Linux in a
virtual machine. We learned a bit about the origins of Linux, how open-source
works, and the difference between Linux distributions.

# Learning Linux command line:


sudo apt install git

. Go to edit, preferences. Here, under the colors tab, I can change the colors for
my window. I'll uncheck use colors from the system theme and I'll change to Tango
light.
. Here, under the colors tab, I can change the colors for my window. I'll uncheck
use colors from the system theme and I'll change to Tango light. You can set your
colors however you like
. we'll install Windows Subsystem for Linux and then we'll restart, and then we'll
install the Ubuntu package from the Windows store. So, to get started, I'll search
for turn Windows features on and off.
In the window that pops up, I'll scroll down to the bottom and tick the box next to
Windows Subsystem for Linux. Then I'll press O And then I'll choose close
. Open up the Microsoft Store and search for Ubuntu. Down here in the Apps section,
here's Ubuntu 18 04. I'll click on it and then choose get. This will download an
Ubuntu environment that will run on top of the Windows Subsystem for Linux.

# How commands are structured:


The general pattern you'll see is command, options, and arguments. Here's a couple
of common commands you'll see with options and arguments that are used with them.
. The command is the program you're running or the action you're taking. Example:
"ls" which means list
. The options, tell the command how to operate, changing the behavior of the
command or telling it to perform different actions.
. The argument or arguments. This is where you tell the command what thing to
operate on. It's usually a file path or a set of files or folders

# Text Navigation shortcuts:


. Ctrl+U: Remove(crop from cursor to start
. Ctrl+C to cancel that command
. A and control + E move to the beginning Ctrl+A and Ctrl+E move to the beginning
and of the line respectively
. The upward angled character you see here is called caret. is called caret, C A R
E T, not like the vegetable
. Ctrl+K deletes from the cursor position deletes from the cursor position to the
end of the line. to the end of the line
. And if you need to Copy+Paste from the Command Line window, you'll need to use
Ctrl+Shift+C and Ctrl+Shift+V and control + shift + V to do that to do that,
instead of the regular Ctrl+C and Ctrl+V. instead of the regular control + C and
control + V.

.The first one is man, which stands for the manual pages: To look up something in
the man pages, type man, followed by the command

* Many commands also have an option called help, which provides a brief amount of
information about them. However, they usually refer you to the man pages for more
detailed documentation. For example, ls-- help.
. But what if you don't know the name of a command you are looking for? In that
case, you can use another program called apropos. Apropos searches a list of
commands and their descriptions for text you provide as an argument. So if I wanted
to find out what can list things, I could type apropos list and see a number of
results that match that word

Chapter questions:
Question: To help you look up a command by its description rather than its name,
you can use
Answer: apropos
Hints: Though not many people know about it, apropos is a very helpful tool for
beginners and pros alike.

Question: To find the manual page for the command ip, you can use:
Answer: man ip
Hint: When looking up a command, man is the command, and the command you're looking
up is the argument!

Question: To move to the beginning of a line of text, you can use:


Answer: Ctrl + A
Hint: And, remember, you can use Ctrl-E to move to the end of the line.

Question: To cancel a command you've typed but don't want to run, press:
Answer: Ctrl + C
Hint: Ctrl + C is a common way to end or cancel a command.

Question: Why isn't the statement /home/alice ls -l valid?


Answer: The argument should be at the end of the command, so it reads ls -l
/home/alice
Hint: The path to Alice's home folder is an argument when using ls, so it should
come last in the sequence of elements of the command.

Question: A shell that's available on many different platforms is called:


Answer: bash
Hint: Bash, or the Bourne Again Shell, is widely available and very powerful

Question: The command line is also called the _____.


Answer: shell
Hint: A command line interpreter, or shell, accepts commands and displays the
results.

# Files, Folders and permissions:


. cd command which stands for change directory
. We can also move back up the folder structure using the cd command and two dots
or two periods. cd ..
. Paths that only use a fragment of the absolute path to a folder, are called
relative paths
. We can use the shortcut cd space dash with a dash character or a minus. That
takes you back to the previously used folder. So, it's great for switching back and
forth between two folders if you need to do that.
# ls command:
. The colors represent different aspects of the files in the listing. Let's go to
the exercise files and look around

. mkdir for making dirctory: Mkdir -p company/employees/project/startdate/enddate


. cp for copy.
. Move has two uses. You can use it to move files between folders, and you can also
use it to rename files. The command for move is mv

# Wildcards: Wildcards are characters that stand for patterns. We'll see more about
patterns in text later
.There's star, or asterisk, and question mark. Star stands for any number of
characters, and question mark stands for one character

Question For Mola-Mfani: when should i use question mark wilcards and star
wildcard?

. Using a "find" command: To use find, I'll type find and then the scope of where
I want to search
. use the dot or period character for the current working directory, which is my
Exercise Files. And then I'll type dash name, which is the test that I'm using to
match files
. I want to match them based on their name. There are other options, like size,
date, and so forth, but I find that I use name the most. Then I'll put a matching
pattern for what I'm looking for.
Example: cd /etc/
find . -name "po*" : this will find all the files under etc directory with or
contains "po"
find . -name "ma*"

# Linux User roles and sudo: We can create files that only one or another user can
access. At the command line, we can switch between users with the su command, which
is variously referred to as set user, switch user, or substitute user.
To use su, we write that command followed by the name of the user we want to switch
to.

* Things to remember:
. Users' files are kept separate
. Switch between users with the su command

# There are two basic user roles in Linux. There's the normal user and the
superuser. The difference here is one of privilege.
. The normal user can modify, create, delete, and move their own files, but they
can't make changes to the system.
. They can't install software, they can't make changes to system files, and
generally speaking, they can't browse other users' home folders.
. The superuser, which is called root, can make changes to the system. It can
install software, it can start and stop services, and so on. Normal users can be
granted the ability to temporarily use root's power through a command called sudo
or sudo. It's uncommon and it's really bad practice to log into the root user
directly to do normal work.

# Normal user:
. Modify their own files; can not make system changes
# Super user(root):
. Modify any files; make system changes
. It's a good idea to type sudo -k to give up those privileges. sudo -k
su -s
. File permissions:
RWX: stand for Read, Write, and eXecute.
Read means that someone can see the contents of a file but not modify it.
Write means that someone can make a change to the file, but not read the contents,
And execute means that someone can run the file, for example, a program or script,
without loading it into another program first.

# Change the permissions of a file using the chmod command


. chmod: change the permissions on a file by modifying the file mode bit.
And we can do that in two ways. The first is to use an octal notation, which uses
three values to represent read, write, and execute. There's another notation with
another digit in front, but that's more advanced than we need to get into right
now.
.The second is called symbolic notation, which uses a shorthand for user, group,
others, and all, an operator, and a list of permissions to change

# file ownership, and group ownership: In the long output of ls, there's two
columns that show the user and group ownership for each file.
sudo chown for change ownership, root, to change ownership to the root user, and
filename

# Create hard and soft symbolic links:Links are files that are references to other
files, and they're used to avoid having multiple copies of the same file in
different places.
* Links:
. A file that acts as a reference to another file

# Hard link:
. Point to data on the disk(inode): ln poems.txt words.txt
# Soft link(symbolic link)
. Point to a file on the disk(relative path) Example: ln -s poems.txt writing.txt

# The Linux filesystem:


. The filesystem starts with root represented by a slash.Root is the highest level
of the organizational hierarchy of the filesystem.
. Home, we've already seen. That's where the regular user's home folders are
stored.
. Root is where root's home folder is stored.
. etc which is where most programs keep their configuration files
. bin and sbin where programs the system relies on to work are kept, and lib where
shared libraries and modules are stored.
. lib where shared libraries and modules are stored.
. The dev folder is where the system keeps references to all the hardware it has:
hard drives, memory, CPUs, and everything else
. the mnt folder which is where local or network filesystems are mounted into the
overall system or
. The media folder where removable filesystems like USB drives and optical drives
are mounted.
. proc which contains references to processes that are running on the system and
has details of other aspects of the system as well
. sys which holds files representing different kernel parameters and system
information

# Chapter Quize:
Question: While all other users' home folders are kept in /home/, the superuser's
home folder is stored at:
Answer: /root
Hint: Root is a special user, and it has a special home folder.
Question: A symbolic link will break if:
Answer: The link or the referenced file is moved
Hint: If you want to make a link that can be moved without breaking, choose a hard
link instead.

Question: The command ln -s outcome.txt report.txt creates:


Answer: A symlink named report.txt that refers to outcome.txt.
Hint: Remember that a symbolic link will break if the link or the original file is
moved.

Question: File permissions let us control who can:


Answer: read, write, and execute a file
Hint: R, W, and X are the fundamental categories of access for the user, group, and
others

Question: We use this command in front of a command we want to execute using


superuser privileges:
Answer: sudo
Hint: This command can be thought of as 'switch user and do', 'superuser do', or
'substitute user and do', depending on who you ask

Question: To find files in Alice's home folder with report in the name, you could
write:
Answer: find /home/alice -name "*report*"
Hint: The find command's syntax is a little bit different from most other commands

Question: To rename the file report.txt to output.txt, you could write:


Answer: mv report.txt output.txt
Hint: While mv is usually used to move files, 'moving' a file within the same
directory has the effect of renaming it.

Question: To delete a folder called Photos which contains many subfolders, you
could write:
Answer: rm -rf Photos
Hint: The -r option tells rm to remove the file hierarchy, not just files. And -f
skips the prompt that rm would normally display for each folder.

Question: If a file path has a space in it, you can wrap the path in quotes, or you
can _____ the space with a \ character.
Answer: escape
Hint: Escaping a character tells the shell to interpret it literally, rather than
as part of a command.

Question: If your current working directory is /home/alice/Documents/Financial, and


you want to change it to /home/alice, you can use this command:
Answer: cd ../../
Hint: This command uses relative path indicators. Two dots .. represents the parent
folder of any given folder.

Question: The rmdir command _____.


Answer: can only delete an empty folder
Hint: The functionality of rmdir is limited to removing folders with nothing inside
them.

# Unix Philosophy:
. Program should do one thing and do it well
. They should text interfaces (take in text, and output text)
. Many lodular tools than one big one
. The standard GNU tools follow this pattern
# Use pipes to connect commands together:
. Pipes take the output of one command and send it to another
. represented as a vertical bar, or sometimes as a vertical bar with a little break
in the middle, is usually the Shift character on the backslash key
. echo, which prints out whatever you give it. example: echo "hello" | wc
echo "hello world from the command line" | wc

# View text files with cat, head, tail, and less:


. cat(concatenate): to link together: it's often used just to print the contents of
a file to the screen. It's also helpful to get the contents of a text file into a
series of piped commands
. head, tail: view lines from the beginning or end of a line: head test.txt, or
tail test.txt
. I can pass the dash N option to head or tail to tell it how many lines to show
me. example: head -n5 test.txt
tail -n3 test.txt
cat test.txt | cat -n | tail -n5

# Less: paginates text and provides navigation controls.


Less takes text input and presents it page by page, or screen by screen, and gives
you some controls to move around within the text. I'll type, less poems.txt and I
see the text with a little bit of an interface around it
Example: less test.txt
less test.txt | less -n | tail -2

# Search for text in files and streams with grep: The grep tool searches text or
files for a given string or pattern of text
Example: grep "the" test.txt
grep -i -n "the" test.txt
. Use grep to omit the lines that we don't want to see.
. grep -vi "the" test.txt
# More detail course: Learning Regular expression

# Manipulate text with awk, sed, and sort:


. Manipulating text: The awk and sed commands can both be used to programmatically
manipulate text in streams or files
. Sort command can be used to reorder lines of text of text according to different
criteria
. rev: print text in reverse sequence
. tac: concatenate and print files in reverse
. tr: translate or modify individual characters according to parameters

# check out Learning vi to dig deeper into the powerful commands:


# I encourage you to explore the course Learning Nano for more details

# Output Redirection: There's the standard input, or standard in,which is keyboard


input,the standard output, or standard out,which is the result of running commands
that comes back to our screen when commands execute correctly
# The third, is standard error,which is the result that comes back from commands
when they don't execute correctly, and they return an error message to us

Chapter Quiz:
Question: On a Linux system, the PATH environment variable represents:
Answer: locations which the shell will search for executable programs
Hint: Without being able to search in the PATH, we would have to type out the full
path to common tools every time we used them
Question: Input and output streams are numbered. Which of these represents the
standard error?
Answer: 2
Hint: This would be a custom file descriptor, not one of the standard streams.

Question: To extract files from a tar file, use the option:


Answer: x
Hint: This option will tell tar to retrieve files from an archive.

Question: In nano, common commands are listed:


Answer: at the bottom of the screen
Hint: As you resize the window, you'll see more or fewer commands.

Question: In nano, what does Ctrl + O (^O) do?


Answer: saves (outputs) the file
Hint: Some of the nano commands are not very intuitive. Luckily, the menu bar at
the bottom of the screen reminds us of some common tasks.

Question: Primarily, Vim has two operating modes:


Answer: command mode and insert mode
Hint: Switch to command mode with Esc and insert mode with "i".

Question: To modify information from a file or stream, this is the best command of
those listed to use:
Answer: sed
Hint: sed is a good choice if you need to modify information.

Question: To show the lines from the file report.txt which match the search term
"completed", write:
Answer: grep "completed" report.txt
Hint: While the double quotes aren't necessary, it's a good practice to use them.

Question: This command lets us scroll around and search in a text file:
Answer: less
Hint: The less command provides a minimal interface within which we can move around
a file.

Question: To view only the first eight lines of the file report.txt, you could
write:
Answer: head -n8 report.txt
Hint: The -n option sets what number of lines to display

Question: This character represents a UNIX pipe:


Answer: |
Hint: This character isn't widely used, so it can be odd to work with at first.

Question: The UNIX Philosophy can be summed up as:


Answer: Tools should do one thing well, and communicate with each other using text.
Hint: We leave it up to the user to combine tools in a way they need to.

cat /etc/*release
CentOS Linux release 7.7.1908 (Core)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.7.1908 (Core)


CentOS Linux release 7.7.1908 (Core)

To find out how much RAM this machine has: free -h (-h for human readable)
total used free shared buff/cache available
Mem: 1.8G 538M 835M 16M 455M 1.1G
Swap: 1.8G 0B 1.8G

cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 58
model name : Intel(R) Core(TM) i7-3840QM CPU @ 2.80GHz
stepping : 9
microcode : 0x19
cpu MHz : 2790.932
cache size : 8192 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl
xtopology nonstop_tsc eagerfpu pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2
x2apic popcnt aes xsave avx rdrand hypervisor lahf_lm fsgsbase flush_l1d
bogomips : 5581.86
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

# To find out how much space is taken up and how much is available on the
system's hard drive:
df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 899M 0 899M 0% /dev
tmpfs 916M 0 916M 0% /dev/shm
tmpfs 916M 9.3M 906M 2% /run
tmpfs 916M 0 916M 0% /sys/fs/cgroup
/dev/mapper/centos-root 16G 6.6G 8.7G 44% /
/dev/sda1 1014M 231M 784M 23% /boot
tmpfs 184M 12K 183M 1% /run/user/42
tmpfs 184M 0 184M 0% /run/user/0

# du command for disk usage, and then slash, which is the level:
sudo du / -hd1
0 /proc
9.3M /run
0 /sys
59M /etc
251M /root
1.7G /var
84K /tmp
4.6G /usr
8.4M /home
0 /media
0 /mnt
0 /opt
0 /srv
6.7G /

# To find out networking information about your system, and to do that, you can
use the ip command, with the a option:
ip -a

Chapter Quizes:
Question: You can find out how much available disk space a system has with:
Answer: df -h
Hint: The -h option shows the numbers in a human-friendly format

Question: While most commands work on most Linux systems, it's important to know
the _____ you're working on, to be aware of differences in package managers and
configuration schemes.
Answer: distribution
Hint: Which distribution you're using will affect many things, large and small.
Question: This command can show you what version of the Linux kernel is currently
running:
Answer: uname
Hint: To get the full amount of information, use the -a option.

# Linux: Files and Permissions: We can identify directories by looking at the


first character on the left of a long list using ls space, dash L.That first
character should be the letter D.If the first character is a hyphen, then it's a
regular file.
This includes most traditional files,like documents and photos. If the first
character's an L, then it's a symbolic link.
.Data that describes other data is called, metadata.
type in ls -l /etc/passwd,This will give us a long list of the etc password file.
# Type in stat /etc/passwd,Stat shows us the name, size, i-nodes,
permissions,ownership, and ASCII Linux security context.It also has the last access
data,just like the ls dash l command.

# ACLs provide inheritance for user and group permissions so newly-created files
can inherit permissions from the parent directory. ACLs also provide the ability to
backup and restore permissions easily.
[root@centos01 ~]# touch aclfile.txt
ls -l aclfile.txt
# [root@centos01 ~]# setfacl -m user:root:rwx aclfile.txt

[root@centos01 ~]# getfacl -t aclfile.txt


# file: aclfile.txt
USER root rw-
user root rwx
GROUP root r--
mask rwx
other r--

[root@centos01 ~]# touch afile.txt


[root@centos01 ~]# sudo chattr +i afile.txt
[root@centos01 ~]# lsattr afile.txt
----i----------- afile.txt
[root@centos01 ~]#

# File Globs: Pattern matching using globs:

Vous aimerez peut-être aussi