Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

File and Directory management

Be First!
by October 25, 2012 LINUX

File and Directory management:
apropos Search the whatis database for files containing specific strings.

bdflush Kernel daemon that saves dirty buffers in memory to the disk.

cd Change the current directory. With no arguments “cd” changes to the users home directory.

chmod
chmod <specification> <filename> – Effect: Change the file permissions.
Ex: chmod 751 myfile
Effect: change the file permission to rwx for owner, re for group
Ex: chmod go=+r myfile Effect: Add read permission for the owner and the group
character meanings u-user, g-group, o-other, + add permission, – remove, r-read, w-write,xexe
Ex: chmod a +rwx myfile Effect: Allow all users to read, write or execute myfile
Ex: chmod go -r myfile Effect: Remove read permission from the group and others
chmod +s myfile – Setuid bit on the file which allows the program to run with user or group
privileges of the file.
chmod {a,u,g,o}{+,-}{r,w,x} (filenames) – The syntax of the chmod command.

chown chown <owner1> <filename> Effect: Change ownership of a file to owner1.

chgrp chgrp <group1> <filename> Effect: Change group.

cksum Perform a checksum and count bytes in a file.

cp cp <source> <destination> Copy a file from one location to another.

dd Convert and copy a file formatting according to the options. Disk or data duplication.

dir List directory contents.

dircolors Set colors up for ls.

file Determines file type. Also can tell type of library (a.out or ELF).

find
Ex: find $Home –name readme Print search for readme starting at home and output full path.
How to find files quickly using the find command:
Ex: find ~ -name report3 –print
l “~” = Search starting at the home directory and proceed through all its
subdirectories
l “-name report3” = Search for a file named report3
l “-print” = Output the full path to that file

install Copy multiple files and set attributes.

ln Make links between files..

locate File locating program that uses the slocate database.

losetup Loopback device setup.

ls
List files. Option -a, lists all, see man page “man ls”
Ex: “ls Docum Projects/Linux” – The contents of the directories Docum and Projects/Linux are listed.
To list the contents of every subdirectory using the ls command:
1. Change to your home directory.
2. Type: ls -R

mkdir Make a directory.

mknod Make a block or character special file.

mktemp Make temporary filename.

mv
Move or rename a file. Syntax: mv <source> <destination> Ex: mv filename directoryname/newfilename

pathchk Check whether filenames are valid or portable.

pwd Print or list the working directory with full path (present working directory).

rm Ex: “rm .*” – Effect: Delete system files (Remove files) –i is interactive option.

rmdir rmdir <directory> – Remove a directory. The directory must be empty.

slocate
Provides a secure way to index files and search for them. It builds a database of files on the system.

stat(1u) Used to print out inode information on a file.

sum Checksum and count the blocks in a file.

test Check file types and compare values.

touch Change file timestamps to the current time. Make the file if it doesn’t exist.

update Kernel daemon to flush dirty buffers back to disk.

vdir List directory contents.

whatis Search the whatis database for complete words.

wheris Locate the binary, source and man page files for a command.

which Show full path of commands where given commands reside.

(535)

Previous
Next

Leave a Reply