Linux Commands: Short List for CTEC145

Linux Commands: Short List for CTEC145

Linux Commands: Short List for CTEC145 Folders/Directories 1. Hierarchical File system Root / bin dev etc home media root sbin tmp usr Directories robert jenny jack Bin notes Files Report Log 2. Touch touch file.25,qwerty #creates a file without content 3. ls #Lists names of directories and files a. > ls –a #includes hidden files b. > ls –l #shows details & permissions of files -rw-rw-r-- 1 chris sales 5555 Jan 11 11:20 file.25,qwerty c. > ls –al #all files in long form 1) drwxrwxrwx 2 root root 1024 Jan 12 13:55 . 2) drwxr-xr-x 3 root root 1024 Jan 10 01:49 .. 3) -rw-r--r-- 1 chris sales 1155 Jan 10 01:50 .Xdefaults 4) “.” pathname of the working directory. 5) “..”pathname of the parent directory 6) .Xdefaults is hidden because of the dot before the name 4. cd #change directory > cd #Takes user to their own home directory > cd ~robert #Takes to home directory of robert > cd ~/Desktop #~ denotes complete path to home directory cd .. #moves up one directory cd /etc #moves to the etc directory 5. Absolute/relative pathnames > cd /home/jsande/Desktop #absolute pathname > cd Desktop #relative pathname 6. mkdir <dir name> #creating a directory > mkdir sales > mkdir folder1 folder2 #can create several directories at once 7. rmdir #removing a directory > rmdir sales 8. rm #removing a file rm <filename> > rm letter > rm –rf sales #will forcible remove a directory w/ contents Linux Commands: Short List for CTEC145 9. pwd > pwd #gives path to current directory 10. man #System manual with help pages on commands man <command> > man who 11. info #More help pages on commands info <command> > info who 12. Exiting > exit exit out of shell > shutdown -h now shutdown OS > shutdown -r now reboot OS Ctrl-c, Ctrl-d, q, <esc> may get you out of a program Linux Commands: Short List for CTEC145 File Commands & vi 1. Filenames: case sensitive: memo5 ≠ MEMO5 ≠ Memo5 restrictions: do not use *, ?, >, <, / 2. cp #Copy a File cp <source-file> <destination-file> > ls output > cp output outputb > ls output outputb > cp /etc/inittab /root > cp /etc/inittab . (copies to present dir) 3. cat Simple word processor > cat > notes To shutdown computer: shutdown –h now. <enter> Ctrl+c View contents > cat notes #Displays content of a text file > cat –n inittab #-n option: numbers the lines 4. Opening vi vi <filename> 5. Edit/Insert Mode Command Action A Appends text after the current character I Inserts text before the current character O Inserts a blank line below the current line <Esc> Exits edit/insert mode 6. Command Mode Command Action :w Writes to file :q Quits editor :wq Writes & quits :w! Forcefully writes to the specified file :q! Quits without saving Dd Deletes a line U Undoes the last change made .(dot) Repeats the last change made Yy Yanks the current line, which is to be copied Nyy Yanks n lines, including the current line P Pastes the yanked text after the current line X Deletes character /<pattern> Finds the next line containing the specified pattern :set nu Numbers each line Linux Commands: Short List for CTEC145 7. more #Scrolls down screen more <file name> 8. less #Scrolls down screen: more, less (can also scroll up) less <file name> > less /etc/inittab 9. mv Change Name of File mv <existing-filename> <new-filename> > ls notes inittab > mv inittab test > ls notes test Move a file to a new location: mv <filename> <path-to-new directory> > mv test /home/robert > cd ~robert > ls 10. chmod 4 setuid 2 setgid 1 sticky-bit # chmod 4511 file1 dr-s--x--x #Group & others can’t read but can execute as if root # chmod 2710 file1 drwx--s--- #Group can’t read but can execute as if root # chmod 1733 file1 drwx-wx-wt #Prohibits groups & others from changing name or deleting files in a directory 11. chown #Changes owner of file/directory chown <username> <filename> # chown john file2 # ls –l file2 -rw-rw-r-- 1 john users 181 Mar 30 2026 file2 # chown mary:sales file2 #Changes owner and group name -rw-rw-r-- 1 mary sales 181 Mar 30 2026 file2 12. chgrp #Changes group of file/directory chgrp bill file2 -rw-rw-r-- 1 john bill 181 Mar 30 2026 file2 .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us