Files, Folders Management

Append “Hello” to /hello.txt

echo "Hello" >> /hello.txt

Replace /hello.txt and put the “Hello” into the /hello.txt

echo "Hello" > /hello.txt

Show file info

wc /root/anaconda-ks.cfg

Delete file(s)

rm *.txt
rm lala.txt

Create text file

touch /tmp/myfile

Show current path

pwd

Show full path of application

which php
which ffmpeg
which httpd

Copy file

cp /root/install.log /root/other/install.log

Move file

mv ~/root/new-wirks/myfile ~/root/old-work

List files

ls -la /etc | more

List files partly, for close press “q”

ls -la /etc | more

Find file where name like “log”

find / | grep log

Show last 10 lines of the file

tail /var/log/messages

Show first 10 lines of the file

head /var/log/messages

Create diretcory

mkdir mydir

Mount cd-rom

mkdir /cdrom
mount /dev/cdrom /cdrom

List files and folder of current folder

du -h

Show size of current folder

du -sh

List “/root” files to “/thefiles” file

du /root >> /thefiles

Get directory total size

du -ch /home/rommel/bachup | grep total

Change file mode

chmod 777 kkk.txt

Change directory mode recursive (with subfolders)

chmod 777 mydir -R
Tags:,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.