Linux CMD
Command on file and directory
cd directory -- go to the directory
cd .. -- back to previous directory
pwd -- show current directory
ls -- show directory listing
ls -al -- formated listing with hidden files
ls /dir -- to find the file list of current location dir
rm file -- delete file
rm -r dir -- delete the directory
rm -f file --force remove file
rm -fr dir -- force remove directory
cp file1 dir/file2 -- copy file1 and save as file2 on the location dir
cp dir1 dir/dir2 -- copy dir1 and save as dir2 on the location dir
mv file1 dir/file2 -- move and rename file1 as file2 on the location dir
mv file1 dir/ -- move file1 on the location dir
mv dir1 dir/dir2 -- move and rename dir1 as dir2 on the location dir
mv dir1 dir/ -- move dir1 on the location dir
ln -s dir/file /targetdir/filename -- create symbolic link or soft link to file
ln dir/file /targetdir/filename -- create hard link to file
ls -lrt *rpm -- search rpm on this directory
touch file -- create or update file
touch uzzal.txt echo "i am uzzal" > uzzal.txt -- create a file uzzal.txt and write on it "i am uzzal"
cat dir/file or more dir/file -- to show content of a file
cat > dir/file -- place standared content to file
head file -- output the first 10 lines of file
tail file or tail -f file -- output the last 10 lines of file
vim /etc/hosts -- to edit host file
>i enter >can change >esc enter >: wq! enter
rpm -qa --last -- last install package list
yum remove package_name -- to remove package
unzip dir/zipfile.zip -- to extract zip file
gunzip apache-tomcat-9.0.55.tar.gz -- unzip .gz
tar xf apache-tomcat-9.0.55.tar -- unzip .tar
wget https://www.rarlab.com/rar/rarlinux-x32-700b2.tar.gz -- download .tar.gz file
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -- download .rpm package
tar -zxvf file.tar.gz -- extract .tar.gz file
yum install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm -- yump install .rpm package
How to Disk Space
df -h shows disk space in human-readable format
df -a shows the file system's complete disk usage even if the Available field is 0
df -T shows the disk usage along with each block's filesystem type (e.g., xfs, ext2, ext3, btrfs, etc.)
df -i shows used and free inodes
du -h /var/www/html ---VVV
du -a shows disk usage for all files
du -sh /var/www/html total disk space used by a particular file or directory