Hi, in this post we learn how to work with files and directory in linux terminal
|
Command |
Description |
# cd /home |
enter to directory '/ home' |
# cd .. |
go back one level |
# cd ../.. |
go back two levels |
# cd |
go to home directory |
# cd ~user1 |
go to home directory |
# cd - |
go to previous directory |
# cp file1 file2 |
copying a file |
# cp dir/* . |
copy all files of a directory within the current work directory |
# cp -a /tmp/dir1 . |
copy a directory within the current work directory |
# cp -a dir1 dir2 |
copy a directory |
# cp file file1 |
outputs the mime type of the file as text |
# iconv -l |
lists known encodings |
# iconv -f fromEncoding -t toEncoding inputFile > outputFile |
converting the coding of characters from one format to another |
# find . -maxdepth 1 -name *.jpg -print -exec convert |
batch resize files in the current directory and send them to a
thumbnails directory (requires convert from Imagemagick) |
# ln -s file1 lnk1 |
create a symbolic link to file or directory |
# ln file1 lnk1 |
create a physical link to file or directory |
# ls |
view files of directory |
# ls -F |
view files of directory |
# ls -l |
show details of files and directory |
# ls -a |
show hidden files |
# ls *[0-9]* |
show files and directory containing numbers |
# lstree |
show files and directories in a tree starting from root |
# mkdir dir1 |
create a directory called 'dir1' |
# mkdir dir1 dir2 |
create two directories simultaneously |
# mkdir -p /tmp/dir1/dir2 |
create a directory tree |
# mv dir1 new_dir |
rename / move a file or directory |
# pwd |
show the path of work directory |
# rm -f file1 |
delete file called 'file1' |
# rm -rf dir1 |
remove a directory called 'dir1' and contents recursively |
# rm -rf dir1 dir2 |
remove two directories and their contents recursively |
# rmdir dir1 |
delete directory called 'dir1' |
# touch -t 0712250000 file1 |
modify timestamp of a file or directory - (YYMMDDhhmm) |
# tree |
show files and directories in a tree starting from root |
|
No comments:
Post a Comment