Unix Tools - Commands Basic and Advance
( recommend : ctrl+f to search keyword or command you want )
Unix Command :
ls -> show contents of current directory
- ls -l -> show as list with some detail
- ls -la -> show as list with more detail, size(byte)
- ls -i * -> to show all file's inode number
- dir -> show contents of current directory(cmd)
- cd direcotry -> go to directory
- cd .. -> go to back tree parent of current directory
- cd / -> go to root directory
- cd ~ -> go to home directory
- cd ${HOME} -> go to home directory
- vi file -> make new file or edit file with vi editor
- pico file -> make new file or edit file with pico editor
- mkdir directory .. -> make new directorys
- mkdir [my\ name] -> make new directory with name space
- rm files .. -> remove or delete files
- rm directory .. -> remove directory (directory must be empty)
- rm -r directory.. -> force remove directory even is not empty
- mv file1 file2 -> rename file1 to file2 in the same directory
- mv file1 dir/file1 -> move file1 to dir/ in current directory as file1
- cp file1 file2 -> copy file1 past file2 in the same directory
- cp file1 dir/file1 -> copy file1 to past in dir/ in current directory as file1
- cat file -> view file content without editing
- cat -n file -> view file with line number
- last -> show time of login on current server
- last -20 -> show time of login on current server by 20 last users
- w -> show who is currently logged in/out server (what user doing)
- who -> show who ..... (show ip)
- man xxx -> help for xxx command
- logout -> logout of server
- ssh user@hostname -> ssh to a host
- date -> show date time
- command1 ; command2 -> using multiple command by ";"
- chmod +xwr files ... -> change permission of files x:execute w:write r:read for all
- chmod u+??? files ... -> change permission for user ( +:add , -:remove , o:other , g:group)
- pwd -> show where you are now ($PWD)
- echo -> display a line of text
- echo [option] [string]
-> echo -n Hello World (-n : no newline after string)
Hello World
- passwd -> change password of user
- zip archivefile.zip file1 file2 ... -> compression file as zip
- unzip archivefile.zip -> extract file zip
- sftp [username]@[host]-> upload file from remote to host
- Ex. I using my macbook to connect with http://bangpra.informatics.buu.ac.th with my username
- Open terminal
- $> sftp username@bangpra.informatics.buu.ac.th
- password: ____
- sftp> ? // to get help
- using l__ for remote
- using __ for host
- using get to download file from host to remote
- using put to upload file from remote to host
- curl -o [URL] -> download file to into current directory from URL
- wget [URL] -> download file or directory into current directory
- wget -r [URL] -> download directory from URL to current directory
- export PS1="change hosting name $"
>> change user display
- du -sh ${HOME} >> show disk usage from tree HOME
- find ${HOME} -type f -size +1M -print | xargs ls -lh >> find file bigger >= 1MB from tree HOME
- find ${HOME} -type f ! -name '*.mp3' -exec grep -l -- "findstring" {} \; >> to find findstring is contents in files which is not *.mp3 from tree HOME
- tar -cvjf archive.tar.bz2 files...Compression file *.tar.bz2
- tar -xvjf archive.tar.bz2 files...Extract file *.tar.bz2
- tar -tvjf archive.tar.bz2 files...List archive file *.tar.bz2
- tar -cvzf archive.tar.gz files...Compression file *.tar.gz
- tar -xvzf archive.tar.gz files...Extract file *.tar.gz
- tar -tvzf archive.tar.gz files...List archive file *.tar.gz
- tar -cvJf archive.tar.xz files...Compression file *.tar.xz
- tar -xvJf archive.tar.xz files...Extract file *.tar.xz
- tar -tvJf archive.tar.xz files...List archive file *.tar.xz
- ln source_file hlink_file...Make a hard link to source file
- ln -s source_file slink_file...Make a soft link / symbolic link to source file
- stat [option] <filename>... show file information
- od [option] <base> <binaryfile>...show content binary file Ex1. od -t x1 file.pdf ... show to show file.pdf as one byt
No comments:
Post a Comment