Help shape GoConqr. What should we add next?

Flashcards

Untitled

Parul Ansal English 6 cards

Cards in this deck (6)

  1. 1cat > hello.txt this is writing to the file hello.txt on top of anything else that is present cat >> hello.txt now appending ctrl + d to save filels -l | tail -n1
    last 1 line gets printed
    $ tail –n/+n filename
    – The -n option displays n lines from the end of the file.
    – The +n option displays the file from line n to the end of the file.
  2. 2sudo - is asuper user, access to all files of the system at kernel level $ cd /sys $ ls $ cd class/ $ cd backlight/ $ lsxdg-open - to open a file
    it will open it to an appropriate program
    xdg-open lecture.html
    will open a browser
  3. 3$ foo = bar wont work bcoz of spaces in btw diff in " " & ' ' echo "the value is $foo" o/p = the value is bar echo 'the value is $foo' o/p= the value is $foo#!/bin/bash
    mcd(){
    mkdir -p "$1"
    cd "$1"
    }
    $ source mcd.sh
    we need to call the function
    $ mcd test
    a directory created named test and cd test happened
  4. 4$ mkdir test $ cd $_ this takes last argument from the last commandeg.
    $ echo test last argument
    $ cd $_
    o/p argument
  5. 5$ grep foobar mcd.sh will search for foobar in mcd.sh file .. $ echo "hello" $ echo $? o/p=0 // everything went fine so it returns 0 $ grep foobar mcd.sh echo $? o/p=1 // foobar not present// 1 indicates error or things didnt go as expected$ false || echo "oops fails"
    o/p = oops fails
    $ echo $?
    o/p =0
    $ false ; echo "hhkj"
    o/p hhkj
  6. 6$ foo = $(pwd) echo "$foo" echo "hello $(pwd)" // works echo "hello $foo" // works echo hello "$foo" //works echo hello $foo //workssee

Information

Description
Flashcards on Untitled, created by Parul Ansal on 24/08/2020.
Created by
Parul Ansal
Views
2
Rating

More on Command Line Basics and Linux Commands

Feedback

What is it about?

What should we add next?