Home - JonatanV/linux GitHub Wiki

Commands för Linux

shutdown

  • --help Show this help
  • -H --halt Halt the machine
  • -P --poweroff Power-off the machine
  • -r --reboot Reboot the machine
  • -h Equivalent to --poweroff, overridden by --halt
  • -k Don't halt/power-off/reboot, just send warnings
  • --no-wall   Don't send wall message before halt/power-off/reboot
    
  • -c Cancel a pending shutdown

cd

  • Change the current directory to DIR. The default DIR is the value of the HOME shell variable.

  • The variable CDPATH defines the search path for the directory containing DIR. Alternative directory names in CDPATH are separated by a colon (:). A null directory name is the same as the current directory. If DIR begins with a slash (/), then CDPATH is not used.

  • If the directory is not found, and the shell option `cdable_vars' is set, the word is assumed to be a variable name. If that variable has a value, its value is used for DIR.

  • Options: -L force symbolic links to be followed: resolve symbolic links in DIR after processing instances of ..' -P use the physical directory structure without following symbolic links: resolve symbolic links in DIR before processing instances of ..' -e if the -P option is supplied, and the current working directory cannot be determined successfully, exit with a non-zero status -@ on systems that support it, present a file with extended attributes as a directory containing the file attributes

    The default is to follow symbolic links, as if -L' were specified. ..' is processed by removing the immediately previous pathname component back to a slash or the beginning of DIR.

passwd

  • -a, --all report password status on all accounts
  • -d, --delete delete the password for the named account
  • -e, --expire force expire the password for the named account
  • -h, --help display this help message and exit
  • -k, --keep-tokens change password only if expired
  • -i, --inactive INACTIVE set password inactive after expiration to INACTIVE
  • -l, --lock lock the password of the named account
  • -n, --mindays MIN_DAYS set minimum number of days before password change to MIN_DAYS
  • -q, --quiet quiet mode
  • -r, --repository REPOSITORY change password in REPOSITORY repository
  • -R, --root CHROOT_DIR directory to chroot into
  • -S, --status report password status on the named account
  • -u, --unlock unlock the password of the named account
  • -w, --warndays WARN_DAYS set expiration warning days to WARN_DAYS
  • -x, --maxdays MAX_DAYS set maximum number of days before password change to MAX_DAYS

more

  • Usage: more

  • -d display help instead of ringing bell

  • -f count logical rather than screen lines

  • -l suppress pause after form feed

  • -c do not scroll, display text and clean line ends

  • -p do not scroll, clean screen and display text

  • -s squeeze multiple blank lines into one

  • -u suppress underlining

  • - the number of lines per screenful

  • + display file beginning from line number

  • +/ display file beginning from search string match

  • -V, --version display version

cat

  • Usage: cat [OPTION]... [FILE]... Concatenate FILE(s) to standard output.

  • With no FILE, or when FILE is -, read standard input.

  • -A, --show-all equivalent to -vET

  • -b, --number-nonblank number nonempty output lines, overrides -n

  • -e equivalent to -vE

  • -E, --show-ends display $ at end of each line

  • -n, --number number all output lines

  • -s, --squeeze-blank suppress repeated empty output lines

  • -t equivalent to -vT

  • -T, --show-tabs display TAB characters as ^I

  • -u (ignored)

  • -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB

  •  --help     display this help and exit
    
  •  --version  output version information and exit
    
  • Examples: cat f - g Output f's contents, then standard input, then g's contents. cat Copy standard input to standard output.

echo

  • skriver ut det du skriver efter echo lamm så skriver de ut lammn

history

  • Skriver ut föregående kommandon

  •  -c	clear the history list by deleting all of the entries
    
  •  -d offset	delete the history entry at position OFFSET.
    
  •  -a	append history lines from this session to the history file
    
  •  -n	read all history lines not already read from the history file
    
  •   	and append them to the history list
    
  •  -r	read the history file and append the contents to the history
    
  •   	list
    
  •  -w	write the current history to the history file
    
  •  -p	perform history expansion on each ARG and display the result
      	without storing it in the history list
    
  •  -s	append the ARGs to the history list as a single entry
    

mkdir

  • Make directory gör en ny mapp med det namn du väljer mkdir banan

cp

  • cp copy kopierar en mapp eller fil
  • -a, --archive same as -dR --preserve=all --attributes-only don't copy the file data, just the attributes --backup[=CONTROL] make a backup of each existing destination file
  • -b like --backup but does not accept an argument --copy-contents copy contents of special files when recursive
  • -d same as --no-dereference --preserve=links
  • -f, --force if an existing destination file cannot be opened, remove it and try again (this option is ignored when the -n option is also used)
  • -i, --interactive prompt before overwrite (overrides a previous -n option)
  • -H follow command-line symbolic links in SOURCE
  • -l, --link hard link files instead of copying
  • -L, --dereference always follow symbolic links in SOURCE
  • -n, --no-clobber do not overwrite an existing file (overrides a previous -i option)
  • -P, --no-dereference never follow symbolic links in SOURCE
  • -p same as --preserve=mode,ownership,timestamps
  •  --preserve[=ATTR_LIST]   preserve the specified attributes (default:
                               mode,ownership,timestamps), if possible
                               additional attributes: context, links, xattr,
                               all
    
  •  --no-preserve=ATTR_LIST  don't preserve the specified attributes
    
  • --parents                use full source file name under DIRECTORY
    
  • -R, -r, --recursive copy directories recursively
  •  --reflink[=WHEN]         control clone/CoW copies. See below
    
  •  --remove-destination     remove each existing destination file before
                               attempting to open it (contrast with --force)
    
  •  --sparse=WHEN            control creation of sparse files. See below
    
  •  --strip-trailing-slashes  remove any trailing slashes from each SOURCE
                               argument
    
  • -s, --symbolic-link make symbolic links instead of copying
  • -S, --suffix=SUFFIX override the usual backup suffix
  • -t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY
  • -T, --no-target-directory treat DEST as a normal file
  • -u, --update copy only when the SOURCE file is newer than the destination file or when the destination file is missing
  • -v, --verbose explain what is being done
  • -x, --one-file-system stay on this file system
  • -Z set SELinux security context of destination file to default type
  •  --context[=CTX]          like -Z, or if CTX is specified then set the
                               SELinux or SMACK security context to CTX
    
  •  --help     display this help and exit
    
  •  --version  output version information and exit
    

mv

  • move flyttar mappar mv
  •  --backup[=CONTROL]       make a backup of each existing destination file
    
  • -b like --backup but does not accept an argument
  • -f, --force do not prompt before overwriting
  • -i, --interactive prompt before overwrite
  • -n, --no-clobber do not overwrite an existing file
  • If you specify more than one of -i, -f, -n, only the final one takes effect. --strip-trailing-slashes remove any trailing slashes from each SOURCE argument
  • -S, --suffix=SUFFIX override the usual backup suffix
  • -t, --target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY
  • -T, --no-target-directory treat DEST as a normal file
  • -u, --update move only when the SOURCE file is newer than the destination file or when the destination file is missing
  • -v, --verbose explain what is being done
  • -Z, --context set SELinux security context of destination file to default type
  •  --help     display this help and exit
    
  •  --version  output version information and exit
    

rm

  • rm står för remove
  • -f, --force ignore nonexistent files and arguments, never prompt
  • -i prompt before every removal
  • -I prompt once before removing more than three files, or when removing recursively; less intrusive than -i, while still giving protection against most mistakes
  •  --interactive[=WHEN]  prompt according to WHEN: never, once (-I), or
                        always (-i); without WHEN, prompt always
    
  •  --one-file-system  when removing a hierarchy recursively, skip any
                        directory that is on a file system different from
                        that of the corresponding command line argument
    
  • --no-preserve-root  do not treat '/' specially
    
  • --preserve-root   do not remove '/' (default)
    
  • -r, -R, --recursive remove directories and their contents recursively
  • -d, --dir remove empty directories
  • -v, --verbose explain what is being done
  •  --help     display this help and exit
    
  •  --version  output version information and exit
    
⚠️ **GitHub.com Fallback** ⚠️