$ uname -a # shows tech info about machine $ chown : # changes user & group ownership $ chmod +rx public_html/ or $ chmod 755 public_html/ '=' causes them to be the only permissions that the file has. '+' causes the permissions selected to be added To remove all permissions from all three user groups: To assign write and execute permissions to user and group: $ ls -al # shows something like this for each file/dir: drwxrwxrwx $ find /home/my_dir -name '*.txt' | xargs grep -c ^.* # counts line numbers on many files and records each count along with individual file name find and xargs are used to circumvent the Linux wildcard limit to apply this function on thousands of files. $ grep 'pattern' file | wc # pipes lines with pattern into word count wc (see chapter 8) wc arguments: -c: show only bytes, -w: show only words, -l: show only lines help on regular expressions: $ man 7 regex or man perlre $ grep -H pattern # -H prints out file name in front of pattern $ grep pattern file # provides lines in 'file' where pattern 'appears', if pattern is shell function use single-quotes: '>' $ dpkg -l | grep mypattern # find Debian packages and refine search with grep pattern $ whereis # searches for executeables in set of directories
Linux quick text paste update#
$ locate # finds files and dirs that are written into update file $ find ~ -type f -mtime -2 # finds all files you have modified in the last two days $ find /usr/local -iname "*blast*" # same as above, but case insensitiveĪdditional useful arguments: -user, -group, -ctime $ find /usr/local -name "*blast*" # finds file names *blast* in specfied directory $ find -name "*pattern*" # searches for *pattern* in and below current directory Online help: SuperMan Pages, Linux Documentation Project (LDP)įinding files, directories and applications $ apropos wc # retrieves pages where wc appears $ info wc # more detailed information system (GNU)
Linux quick text paste manual#
$ man wc # manual on program 'word count' wc $ Ctrl k # delete line from cursor, content goes into kill buffer $ Ctrl a # cursor to beginning of command line $ up(down)_key # scrolls through command history $ ! # starts an old command by providing its ID number $ history # shows all commands you have used recently Paste: Ctrl&Shift&p or right/middle mouse click Usually one of the following methods works:Ĭopy: Ctrl&Shift&c or right/middle mouse click $ cp # copy file/directory as specified in path (-r to include content in directories) $ mv # moves file/directory as specified in path $ rm -r # removes directory including its content, but asks for confirmation, 'f' argument turns confirmation off $ cd # brings you to highest level of your home directory / # moves two directories up (and so on) $ hostname # shows on which machine you are $ whoami # shows as who you are logged in $ stat # provides all attributes of a file $ ll -t # lists files in chronological order $ ll -R # lists subdirectories recursively $ ll -a # includes hidden files (.name) as well $ ll # similar as ls, but provides additional info on files and directories
Linux quick text paste mac os#