Tag: linux
Frequently Used Linux Command Lines
Install WordPress
wget https://wordpress.org/latest.tar.gz
tar xfz latest.tar.gz
cp -r * ~/public_html/your/website/folder/
Change Permissions (rwx => 4 + 2 + 1 = 7)
For Directories: find /path/to/your/directory/ -type d -exec chmod 755 {} \;
For Files: find /path/to/your/file/ -type f -exec chmod 644 {} \;
Permissions
chmod -R 755 directory
chmod -R 644 files
Remove files and directory (use carefully)
rm -rf YourDirectory
Change Owner
chown -R apache new_name (change entire directory)
Remane Directory
mv {old} {new}
Database
To access database: mysql -u root -p
mysql> create database [database name];
mysql> show databases;
mysql> drop database [database name];
More
VI editor
Reference: Using the VI editor
Red Hat Training
Notes from Red Hat System Administration I (RH124) from April 2-6, 2012
Day 1
Covered:
Installing Red Hat 6, which took almost half a day.
Using GNOME graphical desktop.
Editing files with gedit.
Managing files with Nautilus.
Getting help with manuals (F1 for help)
Managing system clock.
Configuring printers.
Command Lines:
uname -r (find out what version of Red Hat)
$ su – (log in as substitute user)
# useradd visitor (add username “visitor”)
# passwd visitor (add password to “visitor”)
# ip addr show eth0 (show ip address)
# ls /usr/share/doc (documentations)
# man man (access manual)
# man -k print (-k is for keyword)
Day 2
Introduced to Bash
Commands entered at the shell prompt have three basic parts:
# chmod +x gedit demo.txt
[command] [options] [arguments]
Command lines:
# pwd (path you’re currently in)
# history
Using the tab key (“tab” “tab”) for completion
# scp filename user@ip-address:/ (copy file from local folder to virtual server)
Introduced to managing physical storage using the graphical interface
Learned to manage logical volumes
Introduced to monitoring system resources
Day 3
Yum
# yum list (get the list of .rpm, which stands for RPM Package Manager)
# yum search kernel (kernel is the name of the package)
# yum install kernel
# yum update kernel
# yum remove kernel
Network
# ip addr show eth0 (eth0 is the name of the network)
# more /etc/sysconfig/network-scripts/ifcfg-eth0
# service network restart
# system-config-network
# ip route
# host visualgui.com
# dig visualgui.com
Users and Groups
# useradd donny
# passwd donny
# vipw (let’s one user edit at the same time)
Manage Files
# echo $PATH
# pwd (current path)
# ls /home/{dir1,dir2} (show more two directories)
# ln file1 file2 (link file 1 to file 2)
# ln -s file1 file2 (symbolic link)
# su – username (change user)
# cp -av /dir/to/copy /dir/destination
Permission
r (view content)
w (change the content)
x (requires r to execute the content)
rw-rw-rw-
rw-r–r–
umask 002
u+s (suid=4: file executes as the user that owns the file, not the user that ran the file
g+s (sgid=2: file executes as the group that owns the file
o+t (sticky=1: no effect)
Day 4
Administer remote system including remote shell access, remote file transfer, using SSH keys
Managing physical storage including filesystem, partition and swap space
Install Linux with Anaconda.
SSH
# scp original-file new-file
# rsync -a /home/student demo:/tmp
-a=all
Archive
# tar -cvf target/to/archive source/to/archive
-c=create
-x=extract
-t=test (tell)
-v=verbose
-f=filename
Using SSH
# ssh-keygen
# ssh-copy-id example.com
# service crond status
# chkconfig –list crond
# vi /etc/ssh/sshd_config
PermissionRootLogin no
PassordAuthentication no
# service sshd restart
Day 5
FTP
# service vsftpd status
# service vsftpd start
# chkconfig vsftpd on
# chkconfig vsftpd –list
httpd
# ll /var/www/
# ln -s /var/ftp/pub /var/www/html/pub
# cat > /var/ftp/pub/index.html
Hello World!