Linux Flashcards
Default text Editor
Vim
Syntax to Launch Vim
vi FileName
:w
write
:q
Quit editor
:!
Exit editor
:wq!
Write/save, Quit, and Exit
yy
yy: copy line
p: paste line
x
Delete character
dd
delete line
whoami
check active user name
id
user id
Root user/super user
The root user has no restriction and can perform ay task.
However, a root user can elevate an ordinary user by granting them sudo privileges by making an entry into SUDO /etc/sudoers file. so they can
they can now perform tasks by prefixing their commands by sudo
- Install packages
- Make configuration changes
- make network changes
- Elevate permissions
Curl or wget
curl or wget.http://xhejfkldwsjnwhedasj/file -o Filename.txt
the -o flag is to specify storage location.
ssh @user ipaddress
check os version
/etc/release
RPM (Redhat package manager)
Granular package installation
Yum installer
wholistic package installer, just like brew for GNU. It finds dependencies, repos and package components.
Under the hood, yum uses RPM
~yum repolist
location of files where package repos are stored
ls etc/yum.repos.d/
to see the list or package repos
Services
enables programs to start automatically when rebooted, as well as start in the right order
system ctl
command to start, enable stop system services:
enable: start upon reboot, or program restart due to failure
system ctl command can be run before configuration
cat /proc/sys/net/ipv4/ip_forward
check ip forwarding status
this can either be st to 0 or 1 using the $echo command
$ ip route || ifconfig
check route table entries
$ ip link
to list and modify links on the host
$ ip addr
to see ip address on the interfaces
$ ip route add
to add entries into route table
Network settings validity
all Network settings are only valid within a boot Lifecycle
$ rmdir vs
$ rm
The rmdir command is used to remove empty directories only and does not have a recursive option like rm -r for removing directories and their contents.
sudo can enable root
$ sudo chmod 444
enables read-only mode for all users on a particular file
$ cat»_space;
vs
$ cat >
// cat»_space;
for appending content to an existing file
for creating or overwriting a file with content/string // use of the command cat >